Ubuntu 9.04 BIND DNS Caching server


BIND, for /Berkeley Internet Name Domain, or named, is the most
commonly used DNS server on the Internet, especially on Unix-like
systems, where it is a /de facto/ standard.  I have found many reasons for a BIND DNS Caching server, and a few of them are email servers to prevent the load from spilling onto your dns servers, apache web servers for the same reason, and for my internal home server just so I can clear my BIND DNS caching server when I want.  I especially like having my own BIND DNS caching server when I am working on a clients DNS so once I make the changes I can clear my cache on my DNS server, and test the change. Lets get started on how to install a BIND DNS Caching server on Ubuntu 9.04.

1.) Install BIND 9 and the BIND 9 utils using apt-get for our BIND DNS caching server.

sudo apt-get update
sudo apt-get install bind9 bind9utils

2.) Point your /etc/resolv.conf to the new servers ip address.

vi /etc/resolv.conf
add “nameserver xxx.xxx.xxx.xxx” to the file

3.) Test your BIND DNS caching server.
dig www.wantlinux.net

You should notice a response the “Query time: 18 msec” from the output of the dig command. Once you make note of the response time repeat the dig command and your response time to decrease drastically. Congratulations your BIND DNS caching server is working. For example my second output was “Query time: 2 msec”. A 16 ms increase in DNS queries might not seem like alot, but when you use spamassassin with DNS options turned on you can make 10-30 DNS queries per email. It adds up quickly when your email server receives 4 messages a second.

Other options for your BIND DNS caching server would be to use your ISP’s dns servers as forwarders, but this does not give you the flexibility of clearing your DNS server cache whenever you want.  If you clear your cache you do not clear your ISP’s DNS cache and you will get the same DNS response. 

Note that BIND caches DNS information to RAM and not disk. In most cases this will not be a problem since most machines have plenty of memory and old records are purged from memory after a period of time. However, if you expect your server to get a lot of traffic you may want to periodically flush the cache using the following command.
sudo rndc -s localhost flush

or set the maximum amount of memory to use (in essence forcing overflow data to be deleted before it expires) by setting the max-cache-size option in the configuration file.

  1. No comments yet.

You must be logged in to post a comment.