DNS changes after reboot Ubuntu server 10.04 LTS

It’s found that the DNS setting is changed to Gateway IP address everytime I reboot the machine. After I have updated /etc/resolv.conf for the correct setting on DNS , it will revert back the wrong setting after every reboot .

This Ubuntu box is running on static IP , so i can safely exclude the possibility of settings on /etc/dhcp3/dhcpclient.conf .

After google for a while , it turns out resolvconf package will update /etc/resolv.conf with the information in /etc/network/interfaces . I have checked this file , but all the settings , including DNS , are correct . Even so , removing this package seems does not affect the system in any way . So I simply remove it , update /etc/resolv.conf with right setting , and reboot. Results?! Same ! /etc/resolv.conf is again overwritten with the wrong setting!

Resolvconf is a framework for keeping track of the system’s information about currently available nameservers. It sets itself up as the intermediary between programs that supply nameserver information and programs that use nameserver information. Examples of programs that supply nameserver information are: ifupdown, DHCP clients, the PPP daemon and local nameservers. Examples of programs that use this information are: DNS caches, resolver libraries and the programs that use them. Ref

Here comes the fix , I need to manually disallow the file /etc/resolv.conf being overwritten ! With google help , I tried to chattr the file , but I fail to do so with following error :

chattr: Operation not supported while reading flags on /etc/resolv.conf” , so first remove resolvconf as follows :

Well , it turns out the package resolvconf avoids attributes of /etc/resolv.conf being changed by “chattr” . So I first uninstall resolvconf package :

% apt-get autoremove resolvconf

Then change attributes for /etc/resolv.conf to avoid it from being changed during every reboot :

% chmod a-w /etc/resolv.conf

Now , the DNS setting keeps unmodified .

You may also like...