Deprecated Behaviour

The inane, sometimes insane, ramblings from the mind of Brenton Alker.

Ubuntu Resetting DNS Setting (resolv.conf)

I have been having a problem with Ubuntu since I installed it (only a few weeks ago now). Every so often, about once a day on average, my DNS settings were being reset.

I had changed the settings in the “Networking” preferences interface, on numerous occasions only to discover later that the settings had been reverted. I figured it was due to the interface being set to DHCP, so I promptly changed it to a static setting (my preference in this case anyway) and thought I would be safe.

So I went ahead and manually added my DNS server (as described in a previous post) to my /etc/resolv.conf

1
nameserver 192.168.1.100

And went about my business. Only to discover a day later it had reverted again. It seems that even though the interface (the only one on the system) is static, that the dhcpclient still automatically reconfigures the DNS settings, to prevent this, the options are either (in order of my preference):

  1. Change the dhcpclient configuration &em; Simply, elegant, sweet

  2. Make resolv.conf read only &em; That’ll show the sucker

  3. Uninstall the dhcpclient &em; I’d prefer not to, it comes in handy if the network breaks

So I took option one and changed the /etc/dhcp3/dhcpclient.conf adding the line:

1
prepend domain-name-servers 192.168.1.100;

The dhcpclient still updates my DNS settings, it’s just conveniently adds my preferred server to the top of the list. Isn’t that nice of it.