Date: Tue, 29 Oct 2002 08:40:39 -0500 From: Dan Pelleg <daniel+fbsdq@pelleg.org> To: Paulo Roberto <nirv199@yahoo.com>, questions@freebsd.org Subject: Re: dhcp option to *not* overwrite /etc/resolv.conf Message-ID: <15806.36823.388867.243667@gs166.sp.cs.cmu.edu>
next in thread | raw e-mail | index | archive | help
> Hi,
>
> I have read the man pages, searched a few forums, but I did not found a
> way to prevent dhcp to do not change my /etc/resolv.conf. I do not have
You can write a script to fix resolv.conf right after dhclient ruined
it. The way to do it is to hook it from /etc/dhclient-exit-hooks
(which you'll need to create). Here's mine, which calls two other scripts (not
included), one of which only if the IP address actually changed. This one
also gets the new servers as arguments.
------------------------------ /etc/dhclient-exit-hooks
# nothing to do unless we're bound
case ${reason} in
BOUND | RENEW | REBIND | REBOOT )
[ -x /etc/set-ntp ] && . /etc/set-ntp
if [ -n "${new_domain_name_servers}" ]; then
if [ -z "${old_domain_name_servers}" ] || [ x${old_ip_address} != x{$new_ip_address} ]; then
[ -x /etc/refresh-named ] && /etc/refresh-named ${new_domain_name_servers}
fi
fi
;;
esac
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15806.36823.388867.243667>
