From Noah.org
Revision as of 11:48, 30 January 2007 by Root (talk | contribs)
Jump to navigationJump to search


If you are running DHCP client then you can put static nameserver in either /etc/dhcp3/dhclient.conf or /etc/resolvconf/resolv.conf.d/base. If you use /etc/resolvconf/resolv.conf.d/base then the changes will persist even if you switch to a static IP or another interface. See resolv.conf for information on going that route.

DHCP with a static DNS

I like to have a few backup DNS servers in my resolv.conf besides the ones hosted by my bandwidth provider. I use OpenDNS and I also add because it's easy to remember and it's open.

Normally DHCP takes care of your DNS settings as well as your IP address. You can't directly add DNS servers to resolv.conf because dhclient will eventually overwrite your changes. But you can tell dhclient to prepend DNS servers to the ones it gets automatically.

Edit your dhclient config file:


Search for the prepend line (it's probably commented out) and set it to the following:

   prepend domain-name-servers,,;

Restart your network:

   /etc/init.d/networking restart

Now cat your resolv.conf file and you should see the new DNS servers:

   cat /etc/resolv.conf