Date: Thu, 6 Dec 2001 15:41:38 -0500 From: Brian T.Schellenberger <bts@babbleon.org> To: Edwin Groothuis <edwin@mavetju.org>, Todd Hansen <tshansen@nlanr.net> Cc: questions@FreeBSD.ORG Subject: Re: resolv.conf Message-ID: <01120615413800.00533@i8k.babbleon.org> In-Reply-To: <20011116124701.K684@k7.mavetju.org> References: <Pine.BSF.4.21.0111151740450.65004-100000@mave.nlanr.net> <20011116124701.K684@k7.mavetju.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 15 November 2001 20:47, Edwin Groothuis wrote: > On Thu, Nov 15, 2001 at 05:43:49PM -0800, Todd Hansen wrote: > > is there a way to specify the search domains for my DNS resolving. I use > > DHCP and as such each time I boot my laptop in a new location the > > resolv.conf file gets overwritten. Is there another place I can specify > > the search domains so that I don't have to use the full domain name? > > You can prevent your resolv.conf to be (completly/partly) overwritten > if you use dhclient.conf correctly. Sorry for replying to such an old post, but . . . An alternative which you may find useful is to supplement the run-time behavior. If you redefine the make_resolv_conf() function of dhclient in the /etc/dhclient-enter-hooks file, then you can "grab" the info that the DHCP server sent. I do this myself because I don't want my /etc/resolv.conf overwritten: I run a local nameserver and I always want to use it, but it's nice to stuff away the DHCP-server supplied version of that file because if my upstream nameservers change then I can easily see how I need to update my named.conf file. In my case they change quite rarely so my function is rather simplistic, and if my nameservers breaks I have to update it's config file by hand, but it would be easy to take this idea further and completely automate the process by having the dhclient process automatically update the named.conf file. In your case, if I'm folloiwng your request properly, you'd really like for the nameservers to be updated but for the search line to be left alone. If that's all you want, then the dhclient.conf solution probably meets your needs (though this solution could readily be made to do the same thing, of course), but for slightly more complex requirements, the enter-hooks is useful. Anyway, for anybody interested in doing something like this, here is my /etc/dhclient-enter-hooks: make_resolv_conf() { # Don't let dhcp reset my name server -- I set it myself. # But for info, set /etc/resolv.conf.auto to the auto-generated # values. echo search $new_domain_name >/etc/resolv.conf.auto for nameserver in $new_domain_name_servers; do echo nameserver $nameserver >>/etc/resolv.conf.auto done } > > Edwin -- Brian T. Schellenberger . . . . . . . bts@wnt.sas.com (work) Brian, the man from Babble-On . . . . bts@babbleon.org (personal) http://www.babbleon.org -------> Free Dmitry Sklyarov! (let him go home) <----------- http://www.eff.org http://www.programming-freedom.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01120615413800.00533>