Prevent DHCP from changing resolv.conf

Timothy Radigan tradigan at newrevolutions.net
Fri Apr 22 09:09:04 PDT 2005


Or, if you don't feel like editing your dhclient.conf, in your
/etc/resolv.conf the first line usually reads:

search thisdomain.com
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.yyy

If you change the first line to read:

domain thisdomain.com
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.yyy

If you change the word search to domain, when the link comes up, dhclient
will not search for upstream domain servers and it won't replace your
hard-coded DNS server list

-- Tim

-----Original Message-----
From: owner-freebsd-questions at freebsd.org
[mailto:owner-freebsd-questions at freebsd.org] On Behalf Of Luke Dean
Sent: Friday, April 22, 2005 11:35 AM
To: Fabian Anklam
Cc: freebsd-questions at freebsd.org
Subject: Re: Prevent DHCP from changing resolv.conf


> I have a minor problem regarding my network configuration,
> specifically that the external interface on my router gets it's IP via
> DHCP from the ISP, so in rc.conf
>
> ifconfig_xl0="DHCP"
>
> is set. This leads to the single entry in resolv.conf that I want to
> be there, namely
>
> nameserver 127.0.0.1
>
> being replaced with my ISP's nameservers, which in return makes
> resolving of LAN IPs or even localhost via the installed BIND
> difficult for the machine. I don't want dhclient to change the
> resolv.conf.
>
> I checked the man pages for resolv.conf, rc.conf and dhclient but
> couldn't find anything there relating to my problem.
>
> Thanks, Fabian

In dhclient.conf, put:
prepend domain-name-servers 127.0.0.1;

This keeps the DNS that DHCP gives you, but it puts your local one first 
so you'll be able to find your local domains.

_______________________________________________
freebsd-questions at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list