resolv.conf

Hi,

My resolv.conf keeps overwritten. I want to have it to just keep the setting that I put in there. I tried a few solutions I found using google.
like supersede domain-name "xxx", prepend domain-name-servers xxx.xxx.xxx.xxx;
This does'nt work.

I also tried to just chmod the file to 444 (-r--r--r--).
This also does'nt work the resolv.conf keeps changing to the settings I believe it is getting from dhcp.

The last thing I tried was chattr +i, but I do not really know what chattr does can any one explain what chattr +i does?

My release I'm running:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.4 LTS"

Options to prevent the resolv.conf getting overwritten are very welcomed.

chattr +i /etc/resolv.conf means make /etc/resolv.conf immutable, i.e. no process can change it. Depending on which filesystem type you are using it may or may not work.

Your problems are due to the NetworkManager service. Lots of discussion out there on this issue. Just do a web search for "Ubuntu NetworkManager resolv.conf."

I always turn off the NetworkManager service on any system I use. I do not want some bit of software silently changing my network settings.

What values are you trying to preserve? You can use the network manager to specify values for DNS servers (i.e. opendns) if you do not want to use the values provided by your ISP. You can also configure your router, in most cases, to provide specific values with the DHCP service.

Be aware that locking down the resolv.conf file will prevent DHCP from updating your gateway and DNS server information. If you travel to places with WIFI hotspots, you will not be able to connect unless you manually update the file.

Well I'm running ubuntu server so the computer goes nowhere and a static ip has been configured so I don't want dhcp configuring anything.
It is also running its own dns, bind9 installed.
So iff the resolv.conf is not pointed to the server its self than the lookup will be done wrong.

The chattr +i solution worked for me but I'm still looking in to a way for disableing the networkmanager.
I have googled but I did'nt found a solution for this yet..

Hi,
This is my opinion.

  1. Just find out how to configure /etc/network/interfaces to set up a fixed ip for your server.
  2. Then type,
    /etc/init.d/networking restart.
    3.Manually type in the ip address in /etc/resolv.conf.
    This would probably solve the issue.