[PLUG] /etc/resolv.conf and DHCP
Paul Heinlein
heinlein at madboa.com
Thu Aug 21 12:59:01 UTC 2003
On Thu, 21 Aug 2003, Steven Raymond wrote:
> So I like to be able to go "ssh hostname" instead of "ssh
> hostname.domain.com". If I edit /etc/resolv.conf with "search domain1.com
> domain2.com" then it tries all of those in order and saves me the trouble
> of typing the domain name.
> When I converted this rh9 machine over to DHCP, I found that
> /sbin/dhclient-script overwrites /etc/resolv.conf and eliminates the
> search parameter. Is there any way to feed options like "search
> domain1.com domain2.com" to dhcpd? I can't figure out how. Or is
> there a another way, perhaps hacking /sbin/dhclient-script so that
> it doesn't overwrite /etc/resolv.conf search parameters?
Red Hat provides a way for the local admin to tell pump or dhclient
not to update /etc/resolv.conf.
Edit /etc/sysconfig/network-scripts/ifcfg-eth0 (replacing 'eth0' with
the actual name of your ethernet interface) and add a single line:
PEERDNS=no
The full and gory details can be found in /sbin/ifup; the relevant
section reads,
if [ "${PEERDNS}" = "no" ]; then
# Do not update/replace resolv.conf.
PUMPARGS="${PUMPARGS} -d"
DHCPCDARGS="${DHCPCDARGS} -R"
fi
Once you've updated the ifcfg file, and assuming you're working at the
machine's console (i.e., not over the network), then
1. /etc/init.d/network stop
2. Edit /etc/resolv.conf to fit your needs
3. /etc/init.d/network start
--Paul Heinlein <heinlein at madboa.com>
More information about the PLUG
mailing list