[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to properly add a dns server



Thanks Bob.  This is quite helpful.  I have comments and further questions inline below.





Why are you overriding the nameserver?  If you control the dhcp server
then the better option is to have it provide the desired information
there instead of having clients override it.


I don't want to override it.  I want to add additional nameservers that "know" about a domain that I need to resolve.  My networking knowledge is kind of thin, but I suspect that this requirement for the other nameservers has something to do with the details of intranet segregation in our corporation . . . does that make sense?  So, I only want to add them as additional lookup sources, coming after the nameservers that the DHCP client discovers as the ones suitable for my own host.  Feel free to point out areas that seem that I really completely don't know what I'm talking about ;)

 
> Can someone explain the moving parts for a noobie?

The dhclient negotiates with the dhcp server for host configuration
information including the nameserver.  It then writes this information
into /etc/resolv.conf where the libc resolver library reads it and
uses it.  Because daemons only read /etc/resolv.conf once when they
start if that file changes then any daemon that needs names must be
restarted in order to read the new contents of the file.  This is why
running a local caching nameserver is nice because it provides one
individual location for this and avoids needing to restart other
randon daemons.


So, just out of curiosity, what is the daemon that is consulted when my browser resolves a name?
 
There are several easy options.

1. The most direct is to edit /etc/dhcp/dhclient.conf and override the
nameserver option.  See 'man dhclient.conf' for details.  Something
like this (untested):

  supersede domain-name-servers 8.8.8.8, 192.168.1.1;


What if I just want to add a couple on the tail of whatever dhclient discovers?  I can read the docs myself . . . but if you know off hand that's its kind of whacky or something, that would be good to know.
 
2. Install resolvconf and use it to override the nameservers.  This is
the one I like the best.

  # apt-get install resolvconf

  Then edit /etc/network/interfaces.  Add a line like this (untested):

  iface eth0 inet dhcp
        dns-nameservers 8.8.8.8 192.168.1.1


Again, if possible, it would be nice to let dhclient do it's thing and then append the new ones.
 


Reply to: