Posted by: jasonk2600 | November 26, 2009

Caching DNS Server Under FreeBSD

Operating your own caching DNS server can improve overall network responsiveness and decreases traffic and load on other DNS servers that are upstream.  The BIND DNS name server (named) is included in the FreeBSD base system and is simple to configure as a caching name server.

Begin by enabling the BIND DNS server to start at system boot:

echo "named_enable=YES" >> /etc/rc.conf

Next, edit the BIND DNS server configuration file located at /etc/namedb/named.conf. In the example below 10.0.2.1 is the IP address of the host running the BIND DNS server, 68.87.69.150 is the IP address of the ISP’s DNS server.  The forwarders setting will cause the BIND DNS server to contact the ISP’s DNS server to resolve any IP addresses that it does not already have in its cache.

listen-on { 10.0.2.1; };
forwarders { 68.87.69.150; };

Finally, be sure to configure your system to start using your newly configured caching DNS server by editing /etc/resolv.conf to use its own IP address for DNS queries.

nameserver 10.0.2.1

Be sure to configure any other hosts or DHCP servers to begin using the IP address of the caching DNS server.  Run the following command to start the caching DNS server, or simply reboot the system.

# /etc/rc.d/named onestart

Reference(s):

 

  [EoF]
Advertisements

Responses

  1. Works great for FreeBSD 9.0. I have it listening on localhost as opposed to the interface IP.

  2. Thanks man, worked like a charm!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: