2

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

1

3 Answers 3

2

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.

0
0

Edit /etc/resolv.conf ; add:

nameserver 208.67.222.222

(this will use opendns)

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

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

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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .