From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 15 18:20:13 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F8AA106566C for ; Fri, 15 Jun 2012 18:20:13 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from qmta10.emeryville.ca.mail.comcast.net (qmta10.emeryville.ca.mail.comcast.net [76.96.30.17]) by mx1.freebsd.org (Postfix) with ESMTP id 30BB98FC0A for ; Fri, 15 Jun 2012 18:20:13 +0000 (UTC) Received: from omta20.emeryville.ca.mail.comcast.net ([76.96.30.87]) by qmta10.emeryville.ca.mail.comcast.net with comcast id Ngb41j0011smiN4AAiK7ci; Fri, 15 Jun 2012 18:19:07 +0000 Received: from damnhippie.dyndns.org ([24.8.232.202]) by omta20.emeryville.ca.mail.comcast.net with comcast id NiK61j0044NgCEG8giK6AZ; Fri, 15 Jun 2012 18:19:07 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id q5FIJ41l035753; Fri, 15 Jun 2012 12:19:04 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) From: Ian Lepore To: Varuna In-Reply-To: <4FDB71B9.9070804@eudaemonicsystems.net> References: <4FDB25E0.2070705@eudaemonicsystems.net> <4FDB3BAA.6090906@fluffy.khv.ru> <4FDB71B9.9070804@eudaemonicsystems.net> Content-Type: text/plain; charset="us-ascii" Date: Fri, 15 Jun 2012 12:19:04 -0600 Message-ID: <1339784344.73426.40.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: /etc/resolv.conf getting over written with dhcp X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 18:20:13 -0000 On Fri, 2012-06-15 at 23:02 +0530, Varuna wrote: > Thanks for the pointers. > > Dima Panov wrote: > > From my /etc/dhclient.conf: > > > > interface "lagg0" { > > send dhcp-lease-time 3600; > > prepend domain-name-servers 127.0.0.1, 4.4.4.4, 8.8.8.8; > > request subnet-mask, broadcast-address, time-offset, routers, > > domain-name, domain-name-servers; > > require subnet-mask, domain-name-servers; > > } > > > > And result is /etc/resolv.conf: > > # Generated by resolvconf > > nameserver 127.0.0.1 > > nameserver 4.4.4.4 > > nameserver 8.8.8.8 > > nameserver 192.168.1.1 > True indeed this will work and I did have a look at dhclient.conf(5) to setup > the freebsd8:/etc/dhclient.conf. This will still call /sbin/dhclient-script > which will overwrite the configuration done to the /etc/resolv.conf each time > the system power is recycled. As per /usr/src/include/resolv.h, the MAXNS is by > default set to 3; which the default configuration user will not be aware of as > the entire focus will be on the ifconfig related flags in /etc/rc.conf. BTW, > the example indicated in dhclient.conf(5) has a typo which says > /etc/dhclient-script instead of /sbin/dhclient-script, indeed the system does > not fail if the typo exists in dhclient.conf. > > > Eugene Grosbein wrote: > > There is simple solution: create file /etc/dhclient-enter-hooks > > and override add_new_resolv_conf() there to do nothing: > > > > add_new_resolv_conf() { > > return 0 > > } > > > > Works just fine for my systems. > Indeed this is a good suggestion, and this is if the user is aware of what to > look for and where in /sbin/dhclient-script it is documented. > > A general sysadmin would be aware of /etc/nsswitch.conf and /etc/resolv.conf for > name resolution issues and I do not think they will be aware of so many possible > ways to handle the issue of resolv.conf getting overwritten by the usage of dhcp. > > What would be the way out? Do you think it would be a good idea to push the > nameserver configuration information into /etc/rc.conf which happens to be the > single file that would handle the system configuration? > > With regards, > Varuna > Eudaemonic Systems > Simple, Specific & Insightful > > IT Consultants, Continued Education & Systems Distribution > +91-88-92-47-62-63 > http://www.eudaemonicsystems.net > http://enquiry.eudaemonicsystems.net > > ------------------------------------------------------------------ > This email is confidential, and may be legally privileged. If you > are not the intended recipient, you must not use or disseminate > this information in any format. If you have received this email in > error, please do delete it along with copies of it existing in any > other format, and notify the sender immediately. The sender of this > email believes it is virus free, and does not accept any liability > for any errors or omissions arising thereof. > Using the 'prepend' or 'supercede' keywords in /etc/dhclient.conf is pretty much the standard way of handling a mix of static and dhcp interfaces where the static config needs to take precedence. I'm not sure why you dismiss it as essentially good, but somehow not good enough. It's been working for me for years. -- Ian