Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2012 12:19:04 -0600
From:      Ian Lepore <freebsd@damnhippie.dyndns.org>
To:        Varuna <varuna@eudaemonicsystems.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: /etc/resolv.conf getting over written with dhcp
Message-ID:  <1339784344.73426.40.camel@revolution.hippie.lan>
In-Reply-To: <4FDB71B9.9070804@eudaemonicsystems.net>
References:  <4FDB25E0.2070705@eudaemonicsystems.net> <4FDB3BAA.6090906@fluffy.khv.ru> <4FDB71B9.9070804@eudaemonicsystems.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1339784344.73426.40.camel>