getting DNS from DHCP IP address

Greg Barniskis nalists at
Thu Jun 16 19:52:24 GMT 2005

David Banning wrote:
> My problem is that the server I use for DNS keeps going dead.
> My ISP is most familiar with windows users who get their DNS
> automatically from their connection.  When my ISP gives me a good
> DNS server number, it seems to go dead six months later, and I have to 
> call them again.    
> Is there a way to get DNS automatically, say from the DHCP connection IP
> address given to me? or, is there some great free DNS server that will 
> stay in business for some time that I can plug into my resolv.conf?
> I am in Toronto, Canada so I guess a DNS should be in reasonable proximity.

Getting DNS server info from the ISP when you get your DHCP lease is 
the typical case, as far as I know (it really has nothing to do with 
Windows users). The special case as it may apply to FreeBSD home 
users is that you might want to be running a home network DNS server 
too (e.g. to host a "myhome.lab" domain). If you're doing that then 
you want the resolv.conf on your firewall to point to localhost (or 
your inside network server) as well as to the ISP DNS servers.

This may be where you're coming from if you are editing resolv.conf 
by hand, whereas DHCP would normally populate resolv.conf for you 
every time your lease is renewed. What you probably want is to 
automatically merge your home network settings with the changing 
info provided by the ISP. Easy to do. I forget the specifics and am 
not at home to check my running config, but I am sure that 
everything you need is within:

man dhclient.conf

You're looking for a "prepend" command to put your local DNS server 
first in resolv.conf, and have DHCP append the ISP's servers. If you 
don't have an internal DNS server, all you need is to send the ISP a 
request for their DNS server addrs (which you'd also do with 

Greg Barniskis, Computer Systems Integrator
South Central Library System (SCLS)
Library Interchange Network (LINK)
<gregb at>, (608) 266-6348

More information about the freebsd-questions mailing list