ORC Owl Logo 2  

Owl River Company

 
  Your IP is: 107.22.114.194

Up More Tips

   http://www.owlriver.com/tips/dhcp_client/

I need to over-ride the resolvers offered by my local DHCP server in /etc/resolv.conf


Recent implementation in DHCP client configurations have made it possible for an end host to over-ride the proffered DNS servers, which an upstream DHCP server suggests. Particularly in a broadband residential environment, it seems, the DNS servers offered are over-loaded.

Fortunately, it is fairly direct to fix this. This example was done under a late beta test version of the cAos project's 'caos-2' desktop distribution. The approach, however, is generic and will work under any Red Hat or closely derived Linux distribution.

Edit /etc/dhclient.conf and restart your network devices:

#
prepend domain-name-servers 66.195.224.112 ;
#

# /sbin/service network restart

which results in an updated resolver setting profile in /etc/resolv.conf

; generated by /sbin/dhclient-script
search gateway.2wire.net
nameserver 66.195.224.112
nameserver 172.16.0.1

... the customary interface level DHCP settings ( /etc/sysconfig/network-scripts/ifcfg-eth0 ) are not involved:

# this file was created by Cinch!
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
USERCTL=no
TYPE=Ethernet
#DHCP_HOSTNAME=hostname

Un-fortunately, this has changed over time as the initscripts have been altered; the documentation has not kept pace with the implementations. In some cases this just doesn't work. Instead, we have to edit ONE of the per interface configuration files.

[herrold@couch ~]$ cat //etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
DNS1=10.16.33.105
DNS2=65.43.29.92
DNS3=66.195.224.112
# USERCTL=no
# PEERDNS=yes
# TYPE=Ethernet
# DHCP_HOSTNAME=localhost

Even MORE un-fortunately, this is not the only place that change has happened. We may need to amend /etc/resolv.conf.predhclient, which is mentioned in /sbin/dhclient-script, but lacks a man page.

-bash-3.00# cat /etc/resolv.conf.predhclient
; generated by /sbin/dhclient-script
search first.lan
nameserver 65.43.29.91
nameserver 66.195.224.112
-bash-3.00#

Note that THIS newly refers to /sbin/dhclient-script. Silly us, expecting clean documentation.



We make this available for non-commercial and individual use. Please respect our copyright, and consider contacting us for all your Open Source and *nix design, architect / systems analysis, and administration needs.


rev 070307 RPH
http://www.owlriver.com/tips/dhcp_client/
Up More Tips
       

Back to Top Page
[legal] [ no spam policy ] [ Copyright] © 2008 Owl River Company
All rights reserved.

Last modified: Thu, 08 Mar 2007 13:51:05 -0500
http://www.owlriver.com/tips/dhcp_client/index.php