Pages

Friday, April 23, 2010

Ubuntu Tricks: Use Static DNS with DHCP

This re-post from noob12 works perfect.

Edit /etc/dhcp3/dhclient.conf

Add or replace a line
prepend domain-name-servers your.name.server.ipaddr;

where your.name.server.ipaddr is replaced by your desired name server. You can list multiple servers in sequence by using a comma-separated list. Don't forget the semi-colon at the end of the line.

This tells dhclient to prepend these servers to whatever list it gets from the DHCP service when writing the /etc/resolv.conf. You'll see them (listed before the others) in the /etc/resolv.conf after DHCP completes. Normal resolution semantics then apply to this list, namely these servers will be used first; if they fail to respond, the client will proceed to following ones, but subsequent servers are not used if any returns an actual result, even if it is NXDOMAIN (i.e. not found).

You can entirely supersede the servers provided by the DHCP service using
supersede domain-name-servers your.name.server.ipaddr;

No comments:

Post a Comment