From owner-freebsd-questions Thu Dec 6 21:45:29 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail4.nc.rr.com (fe4.southeast.rr.com [24.93.67.51]) by hub.freebsd.org (Postfix) with ESMTP id BA08237B41A for ; Thu, 6 Dec 2001 21:45:25 -0800 (PST) Received: from i8k.babbleon.org ([66.57.85.154]) by mail4.nc.rr.com with Microsoft SMTPSVC(5.5.1877.687.68); Fri, 7 Dec 2001 00:49:10 -0500 Content-Type: text/plain; charset="iso-8859-1" From: Brian T.Schellenberger To: Edwin Groothuis , Todd Hansen Subject: Re: resolv.conf Date: Thu, 6 Dec 2001 15:41:38 -0500 X-Mailer: KMail [version 1.2] Cc: questions@FreeBSD.ORG References: <20011116124701.K684@k7.mavetju.org> In-Reply-To: <20011116124701.K684@k7.mavetju.org> MIME-Version: 1.0 Message-Id: <01120615413800.00533@i8k.babbleon.org> 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 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