From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 15 17:31:56 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1A641065676 for ; Fri, 15 Jun 2012 17:31:56 +0000 (UTC) (envelope-from varuna@eudaemonicsystems.net) Received: from lnx6.securehostdns.com (174.36.194.176-static.reverse.softlayer.com [174.36.194.176]) by mx1.freebsd.org (Postfix) with ESMTP id 6235E8FC25 for ; Fri, 15 Jun 2012 17:31:56 +0000 (UTC) Received: from [117.198.253.232] (port=50602 helo=shastry.eudaemonicsystems.net) by lnx6.securehostdns.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77) (envelope-from ) id 1SfaNG-0003dp-Ks for freebsd-hackers@freebsd.org; Fri, 15 Jun 2012 23:01:55 +0530 Message-ID: <4FDB71B9.9070804@eudaemonicsystems.net> Date: Fri, 15 Jun 2012 23:02:41 +0530 From: Varuna Organization: Eudaemonic Systems User-Agent: Thunderbird 2.0.0.23 (X11/20100716) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4FDB25E0.2070705@eudaemonicsystems.net> <4FDB3BAA.6090906@fluffy.khv.ru> In-Reply-To: <4FDB3BAA.6090906@fluffy.khv.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - lnx6.securehostdns.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - eudaemonicsystems.net X-Source: X-Source-Args: X-Source-Dir: 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 17:31:56 -0000 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.