DHCP

From Noah.org
Revision as of 11:48, 30 January 2007 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

DHCP

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 4.2.2.2 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:

   /etc/dhcp3/dhclient.conf

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

   prepend domain-name-servers 208.67.222.222, 208.67.220.220, 4.2.2.2;

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