Jump to content

ubuntu apt-get not resolving url


 Share

Recommended Posts

I have just installed Ubuntu (dapper) onto a spare machine and was attempting to update using synaptice (and apt-get) howver it was unable to find any of the repositories I believe it is having a problem resolving the url as when I amended the /etc/hosts file to specify the ip and url the update works fine.

 

the internet works OK and I can pint the url without any difficulty, it appears to only be apt-get and synaptic that have difficulties. Any ideas what could be wrong.

 

Thanks

Leo

Link to comment
Share on other sites

Yes, my router address is in /etc/resolv.conf

 

I was having other issues with the install so I wiped it all and started from scratch I now have it sort of working (even my wireless connection now works, after a fashion).

 

It still has issues when attempting to connect to the repositories though as it will not find find them unless I ping the repository (using the domain name) from the command line. If I don't do this it will hang for a while before failing to connect (I have assumed the delay is while it is trying to establish a connection).

 

Leo

Link to comment
Share on other sites

Yep your router is not holding the resolution for the address...(or forwarding it properly)

Just checking your not behind a proxy are you? or your router isn't acting as one?

 

The easiest fix is just to add another DNS server (almost any will do) as an extra option...

Here is mine....

nameserver 192.168.1.255

nameserver 212.27.54.252

nameserver 212.27.53.252

 

iot looks first at the local one and if it doesn't find it has the two from my ISP to search too

 

The prob I had with ubuntu was fixing the DHCP add to stop overwriting this!

Its probably easier to use your ISP's DNS alround (if a few ms slower) or just add it to the resolv.conf

 

edit

oops wrong button...

make sure the hosts: line in nsswitch.conf reads

hosts: files dns

then it checks the hosts file first.

Edited by Gowator
Link to comment
Share on other sites

Cheers, that makes sense (although I don't understand why apt-get should have a problem but not ping).

 

The router is not acting as a proxy I will amend the resolv.conf file as you suggest and have a look at the nsswitch.conf file too.

 

How did you stop DHCP overwriting the resolv.conf file (I am using DHCP too).

 

Thanks

Leo

Link to comment
Share on other sites

If you're using your router for DNS, then this is effectively using proxy-dns for any DNS requests you make.

 

Effectively, when you ask your router, your router then asks your isp anyway. If you use your ISP's DNS entries, then you'll bypass what the router is effectively doing for you, and thus saving a step in the DNS lookup process.

 

I'd be tempted to set your connection for static IP for testing, and then configure it accordingly, and set your DNS entries to your isp and see what happens. If it's faster, then change your /etc/resolv.conf to use your router, and see if it slows down. If so, you know where the problem exists.

Link to comment
Share on other sites

Alternatively to adjusting the /etc/resolv.conf: Open your /etc/modprobe.d/aliases file and change as superuser

 

alias net-pf-10 ipv6

 

to

 

alias net-pf-10 ipv6 off

 

If you want to do the resolv.conf thing and want to make sure it doesn't get overwritten (=if you don't want to change the nsswitch.conf file), type as superuser after you added DNS servers to the file:

 

sudo chattr +i /etc/resolv.conf

 

and the file will be hard-locked. (use chattr -i ... for unlocking the file again)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...