Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I changed the nameserver in the /etc/resolv.conf to the DNS server I want to use, but whenever the server gets restarted for whatever reason, it reverts back to the default DNS server. How can I change it so that it is a permanent change? Thanks.

share|improve this question
up vote 3 down vote accepted

Your resolv.conf is probably being overwritten by dhcp.

Are you using DHCP? You can validate by hand editing your resolv.conf and then restarting your dhcp client.

There are overrides for what DHCP provides for most OSes.

I notice you tagged as Ubuntu. Try looking at /etc/dhcp3/dhclient.conf to hardcode your domain-name-server entries.

Good luck.

share|improve this answer
I assume I am using DHCP. I'm a LITTLE new with Ubuntu networking. How would I go about setting the namserver permanently? – Chiggins Feb 3 '11 at 1:56
do you want to always use YOUR nameserver or use the one provided by DHCP and yours? (Can you configure the DHCP server to provide the info you want?) – Joel K Feb 3 '11 at 2:00
'man dhclient.conf' if you want to go down the rabbit hole. Try 'supersede domain-name-servers' in that file if you want to ignore what your dhcp server sends and use instead. – Joel K Feb 3 '11 at 2:01
So do I just add 'supersede domain-name-servers' to the end of the file, it should use as the DNS server? – Chiggins Feb 3 '11 at 2:33
Give it a try and you tell me. :) I use supercede domain-name to force a domain name on some of my systems. – Joel K Feb 3 '11 at 5:19

I could be mistaken in a server environment, but Joel K is correct in that resolv.conf is being overwritten by DCHP. However the file /etc/network/interfaces can override an interface. if you're running a server, you should probably add all that info statically anyways

Here's a basic article on interfaces

share|improve this answer

To get past DHCP hooks which overwrite the /etc/resolv.conf file on Ubuntu, you need to install the resolvconf package and manually edit its base configuration file with your appropriate nameserver or other DNS options in order to make changes permanent to system-wide resolv.conf file. You can use this short tutorial in order to permanently populate resolv.conf file on Ubuntu with your custom DNS entries

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.