resolv.conf doesn't get set on reboot when networking is configured for static ip

Posted by kenneth koontz on Ask Ubuntu See other posts from Ask Ubuntu or by kenneth koontz
Published on 2012-04-29T04:46:53Z Indexed on 2012/06/27 9:23 UTC
Read the original article Hit count: 513

Filed under:
|

I'm experiencing, what appears to be a hostname resolution issue in ubuntu 12.04 server edition when configuring my computer to use a static ip.

In /etc/network/interfaces:

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.28
netmask 255.255.255.0
gateway 192.168.1.1

Running $ sudo apt-get upgrade, results in a 'Failed to fetch...':

. . . W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/universe/i18n/Translation-en_US Something wicked happened resolving 'us.archive.ubuntu.com:http' (-5 - No address associated with hostname)

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/universe/i18n/Translation-en Something wicked happened resolving 'us.archive.ubuntu.com:http' (-5 - No address associated with hostname)

E: Some index files failed to download. They have been ignored, or old ones used instead.

When I change my /etc/network/interfaces to:

auto eth0
iface eth0 inet dhcp

Everything works fine.

Looking into /etc/resolv.conf provides some more hints...In cases where I was getting the resolving issue, resolve.conf was empty. No nameservers were specified. When I changed to dhcp from static and restarted networking. /etc/resolv.conf gets written to: 'nameserver 192.168.1.1'. Switching back from dhcp to static and restarting doesn't remove the nameserve entry. When I restart the system with static set, resolv.conf is empty. When I restart the system with dhcp set, resolv.conf has nameserver 192.168.1.1. So it appears that the issue is that resolve.conf is not getting written to correctly? Which package/code is responsible for writing to resolv.conf? Is there a particular package that I can take a look at open issues?

UPDATE: istream posted a good article discussing changes to resolve.conf in 12.04. http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/

© Ask Ubuntu or respective owner

Related posts about networking

Related posts about 12.04