Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Nov 2004 00:47:37 -0500
From:      Eric Thornton <gonesurfing@nc.rr.com>
To:        Andrew Smith <bsd-questions@andsmith.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: DHCP & nameservers
Message-ID:  <1100324857.20355.8.camel@nicoya.surfbbx>
In-Reply-To: <030e01c4c941$57333f10$19c8a8c0@loriandsmith>
References:  <31173C0B4EF5D611A021009027CB2CBD0A78FF3F@fl08exm04> <419598F0.9000506@trini0.org> <030e01c4c941$57333f10$19c8a8c0@loriandsmith>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2004-11-13 at 00:26 -0500, Andrew Smith wrote:
> I'm using my FreeBSD box as the gateway machine for my cable modem. 
> Obviously the cable modem side has to be set as DHCP, which automaticlly 
> sets the DNS nameservers in resolve.conf.
> 
> However I am running a caching name server on the box, and would like to 
> have resolve.conf only point to local host.  Is there any way to keep DHCP 
> from updating resolve.conf?
> 
> Thanks in advance,
> 
> Andrew 

To keep dhclient from updating /etc/resolv.conf, create a file
called /etc/dhclient-enter-hooks with the contents

#!/bin/sh
make_resolv_conf() 
{
}

If you want to point your cache at a list of upstream servers you can
put dhclient info in a file for use by your server. I have the following
in my enter hooks so that dnscache (djbdns) can use the info instead of
going to root servers every time.

#!/bin/sh
#This script will update dnscache forwarders list

make_resolv_conf() {
  if [ x"$new_domain_name_servers" != x ]; then
    rm /etc/dnslist
    for nameserver in $new_domain_name_servers; do
      echo $nameserver >> /etc/dnslist
    done
  fi
}

Hope this helps.

Eric





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1100324857.20355.8.camel>