From owner-freebsd-questions Sun Mar 9 10:15:43 2003 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 DBE9937B404 for ; Sun, 9 Mar 2003 10:15:41 -0800 (PST) Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5BE6143FCB for ; Sun, 9 Mar 2003 10:15:41 -0800 (PST) (envelope-from mbsd@pacbell.net) Received: from atlas ([64.168.24.185]) by mta5.snfc21.pbi.net (iPlanet Messaging Server 5.1 HotFix 1.6 (built Oct 18 2002)) with ESMTP id <0HBH000SGUQ4N1@mta5.snfc21.pbi.net> for FreeBSD-Questions@FreeBSD.org; Sun, 09 Mar 2003 10:15:40 -0800 (PST) Date: Sun, 09 Mar 2003 10:15:40 -0800 (PST) From: =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= Subject: Re: DHCP Server "learning" name servers since server itself is dhcp'd?? In-reply-to: <200303082234.19615.dkelly@HiWAAY.net> X-X-Sender: mikko@atlas.home To: David Kelly Cc: FreeBSD-Questions@FreeBSD.org Message-id: <20030309100615.Y6008-100000@atlas.home> MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=ISO-8859-1 Content-transfer-encoding: 8BIT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 8 Mar 2003, David Kelly wrote: > On Saturday 08 March 2003 12:32 pm, Mikko Työläjärvi wrote: > > > > It is more elegant in perl, but dhclient-enter-hooks is a > > shellscript, so it felt easier to just add it there. > > /etc/dhclient-enter-hooks needs to be created in any case if you wish to > use named else it will write an /etc/resolv.conf containing the values > given by the DHCP server. Something like this is all it takes to keep > it from changing your resolv.conf: > > #!/bin/sh > make_resolv_conf() { > } I know. > Naturally, one could expand my null'ed make_resolv_conf() to 1) verify > DNS servers have changed, and 2) write them in /etc/namedb/named.conf, > then 3) "ndc restart" That is what I'm doing, as would have been evident from the part of the mail you snipped... I also update time servers, web proxies, time zone, smtp forwarder and a few other things. > My ISP has done something in the past year or so that dhclient thinks > each and every lease renewal is practically a new lease. > /etc/resolv.conf gets (actually, only "attempted" now) written on each > renewal. /var/log/messages gets flooded with this: > > Mar 8 21:14:29 grumpy dhclient: New Network Number: 24.214.34.0 > Mar 8 21:14:29 grumpy dhclient: New Broadcast Address: 24.214.34.255 After having been confronted with a number of different more or less broken DHCP setups, I have come to the conclusion that the information seldom is directly usable. Instead one has to do pattern matching on the data from the server and map to a collection of known settings for known locations, plus a sanity-checking fallback case for new, untried locations. $.02, /Mikko To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message