resolver doesn't see resolv.conf changes

Lowell Gilbert freebsd-stable-local at be-well.ilk.org
Sat Apr 8 13:48:40 UTC 2006


Lowell Gilbert <freebsd-stable-local at be-well.ilk.org> writes:

> Ulrich Spoerlein <spoerlein at googlemail.com> writes:
> 
> > Lyndon Nerenberg wrote:
> > > The solution is to run a local caching nameserver instance.  You should do this anyway, for 
> > > performance reasons. Add 'named_enable="YES"' to /etc/rc.conf, and modify your 
> > > /etc/dhclient.conf as follows:
> > 
> > Good idea, but this defeates the hierarchical purpose of DNS. Now my
> > caching DNS is always querying the root DNS servers.
> 
> I worked around that by having dhclient-script rewrite the named.conf
> (to add a "forwarders" clause), and restart the named.  I don't have a
> laptop any more, and this doesn't seem to be one of the scripts I keep
> around in my web pages, but I could go back to old backups for it...

Oh, look I found it.  This was with the old (ISC) dhclient, but I
think it should work with the current one also.  

dhclient-enter-hooks looked like this:

 #!/bin/sh

 realfile=/etc/namedb/forwarders-list
 tempfile=${realfile}-temp
 if [ x"$new_domain_name_servers" != x ]; then
     echo '      forwarders {' > $realfile
     for n in $new_domain_name_servers ; do
         if [ "${n}" != "127.0.0.1" ] ; then
             echo "      ${n};" >> $realfile
         fi
     done
     echo "      };" >> $realfile
 else
     cp $realfile $tempfile
 fi

 if ! diff $realfile $tempfile > /dev/null ; then
     cpp -P -C /etc/namedb/named.conf > /etc/namedb/named.usable.conf
     ndc reload
 fi

where as you can probably tell I was using a dhclient.conf that
included 
 prepend domain-name-servers 127.0.0.1;
in order to get the standard resolv.conf rewriting to put the local
nameserver at the top preference.

named was configured to use named.usable.conf, which was built from a
named.conf that had '#include "forwarders-list"' in its top-level
options.  


It's a bit of a hack, but it lets you use the DHCP-supplied nameserver
without any glitches when the address for that server changes under
you.  


More information about the freebsd-stable mailing list