Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a ubuntu 12.04 server. Running sudo apt-get update on it produces errors like this:

    W: Failed to fetch http://au.archive.ubuntu.com/ubuntu/dists/precise-backports/main/binary-i386/Packages  Something wicked happened resolving 'au.archive.ubuntu.com:http' (-5 - No address associated with hostname)

I am able to ping all the other hosts on the network and also Google's DNS 8.8.8.8. But am unable to ping www.google.com.

So, I'm guessing something is wrong with my DNS setup, but not sure what.

I use static IP and my /etc/network/interfaces looks like this:

    auto eth0
    iface eth0 inet static
    address 192.168.1.50
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.0.255
    gateway 192.168.1.1
    #dns-nameserver 203.12.160.35 203.12.160.36
    #nameserver 203.12.160.35 203.12.160.36

My /etc/resolv.conf and /etc/resolvconf/resolv.conf.d/base are both empty and my /etc/resolvconf/resolv.conf.d/original says:

    nameserver 192.168.1.1

Any help would be greatly appreciated.

P.S. I've googled it a bit and the common resolution is to switch to DHCP which I don't want to do since this is my home server.

Thanks Srini

share|improve this question
    
Update: Other searches (ubuntuforums.org/showthread.php?t=2070530) suggest updating the DNS settings using Gnome. Since I don't have a GUI, I'm not sure which conf files that updates. –  Srini Oct 14 '12 at 8:47

3 Answers 3

up vote 2 down vote accepted

Add your own (or a public) name server address to /etc/resolvconf/resolv.conf.d/base and run resolvconf -u to update the configuration.

Are the two addresses 203.12.160.35 and 203.12.160.36 from your network configuration the name servers you're supposed to use? In that case add those to the base file.

share|improve this answer
    
This is great. Thanks a lot. –  Srini Oct 14 '12 at 14:02

Edit /etc/resolv.conf ; add:

nameserver 208.67.222.222

(this will use opendns)

restart networking: /etc/init.d/networking restart

share|improve this answer
    
When the package resolvconf is installed, the file /etc/resolv.conf is auto-generated. Manual changes will be dropped without warning. –  Ansgar Wiechers Oct 14 '12 at 12:52
    
Yes, the contents of /etc/resolv.conf re-affirms this. –  Srini Oct 14 '12 at 14:02
    
Ok, seems I'm no longer up to date. I upvoted your solution :-) –  johanvdw Oct 14 '12 at 15:33

DNS operation in Ubuntu 12.04 has changed substantially and in my opinion is slightly incomplete however it is an improvement, it's only lacking a local dns cache and can be installed manually.

see http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/

How to correctly add static entries to resolv.conf is open up your terminal.

sudo nano /etc/resolvconf/resolv.conf.d/base

add two public and your local if you have one

nameserver [your_local]
nameserver 208.67.222.222
nameserver 208.67.220.220
  • Backup your existing resolv.conf

    cp /etc/resolv.conf ~/resolv.conf_backup

Now make sure /etc/resolv.conf is a symlink to /run/resolvconf/resolv.conf

sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf

Reconfigure resolvconf package

sudo dpkg-reconfigure resolvconf

When asked "Prepare /etc/resolv.conf for dynamic updates?" select "yes" and follow instructions.

Troubleshooting

You can run into a situation where the default timeout can impede performance (delays of 5 seconds on name resolution can be quite costly especially to database / http services)

There are 3 ways you can resolve this problem:

  • add the name entries to your hosts file, This is more of a work around than a fix

    Edit your /etc/hosts and add static entries for the hosts. Please note this can prolong debugging later

  • alter the default timeout in resolvconf package

    sudo echo "options timeout:2" >> /etc/resolvconf/resolv.conf.d/tail

  • add a dns cache

    There are a few options I'm not going to cover.

share|improve this answer
    
Thanks for the detailed explanation. Great answer –  Srini Oct 14 '12 at 14:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.