Date: Sun, 30 Apr 2006 22:51:10 -0400 From: "fbsd" <fbsd@a1poweruser.com> To: "Telting" <telting@comcast.net>, <freebsd-questions@freebsd.org> Subject: RE: Getting DHCP to use resolv.conf? Message-ID: <MIEPLLIBMLEEABPDBIEGKENOHFAA.fbsd@a1poweruser.com> In-Reply-To: <444FCCAA.7060401@comcast.net>
next in thread | previous in thread | raw e-mail | index | archive | help
I got this from the ISC-dhcp questions list. Note: This might not work, Not tested, No guarantees. Use this as starter code and after testing post what you get working for the list archives. In dhcpd.conf comment out the line "option domain-name-servers" and add following line include "/etc/dhcpd.name-servers"; This will include the contents of the named file into dhcpd.conf. It is easier to manipulate a small separate file containing only a single line, rather than trying to manage the whole dhcpd.conf file Every time dhcp-client runs it will try to run /etc/dhclient-exit-hooks file if it exists. Create a empty /etc/dhclient-exit-hooks file and populate with this ############### Start of refresh dhcpd dns ip #################### # This script will propagate to dhcpd the changed dns servers ip address # which dhcp-client puts in resolv.conf. # # In dhcpd.conf replace the "option domain-name-servers" line with this # # include "/etc/dhcpd.name-servers"; # # Spript uses the dhcpc variables to build temp line in dhcpd format. # Then compare temp content to production content. # If different replace production content with new content from temp, # and restart dhcp to reread dhcpd.conf containing new ISP dns ip addresses. # # logging event and sending email to user root is optional. # # Note: All LAN machines using dhcpd will not get new ISP dns ip addresses # until they reboot or their lease comes up for renewal. # # Each of the following lines must be one long line. IE: no wrap arounds #################################################################### #### # load my_domain_name_servers variable with ISP dns ip addresses from dhcpc my_domain_name_servers=`echo $new_domain_name_servers | sed -e 's/ /, /g'` # Create single line in file to be included in dhcpd.conf echo "option domain-name-servers $my_domain_name_servers ;" > /etc/dhcpd.name-servers.tmp # See if different from what production file contains cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers if [ $? -gt 0 ]; then # move the new file into place mv /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers # restart dhcp using whatever is appropriate for your platform #service dhcpd restart /usr/local/etc/rc.d/isc-dhcpd.sh restart -q # Write message to log to document event. logger -t dhclient ISP DNS IP address changed to $new_ip_address # Send notification email to root user. This can wrap to next line. mail -s "dhcp client changed ISP DNS IP addresses" root The dhclient-exit-hooks script was invoked and has determined that your ISP changed the IP address of their DNS servers. The new values have been auto updated to dhcpd.conf and dhcpd restarted so they are now in effect. Note: All LAN machines using dhcpd will not start using the new ISP dns ip addresses until they reboot or their lease comes up for renewal. fi rm -f /etc/dhcpd.name-servers.tmp ############### End of refresh dhcpd dns ip #################### -----Original Message----- From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Telting Sent: Wednesday, April 26, 2006 3:40 PM To: freebsd-questions@freebsd.org Subject: Getting DHCP to use resolv.conf? I would like to know how I can propagate the dns servers which the dhcp client puts in resolv.conf to dhcpd. I only see how I can only explicitly list a domain server with "option domain-name-servers". How do I propogate non static dns servers? Chris _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MIEPLLIBMLEEABPDBIEGKENOHFAA.fbsd>