From owner-freebsd-questions@FreeBSD.ORG Mon May 1 02:51:16 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDCD116A401 for ; Mon, 1 May 2006 02:51:16 +0000 (UTC) (envelope-from fbsd@a1poweruser.com) Received: from mta13.adelphia.net (mta13.mail.adelphia.net [68.168.78.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3EF3843D49 for ; Mon, 1 May 2006 02:51:16 +0000 (GMT) (envelope-from fbsd@a1poweruser.com) Received: from barbish ([70.39.69.56]) by mta13.adelphia.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with SMTP id <20060501025115.DMDT27153.mta13.adelphia.net@barbish>; Sun, 30 Apr 2006 22:51:15 -0400 From: "fbsd" To: "Telting" , Date: Sun, 30 Apr 2006 22:51:10 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <444FCCAA.7060401@comcast.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Importance: Normal Cc: Subject: RE: Getting DHCP to use resolv.conf? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: fbsd@a1poweruser.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2006 02:51:17 -0000 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"