djbdnsrocks.org latest news
A major site renovation is under way. Please excuse the mess while this is in progress.
Home
About
The Installation
Extra Options
faq
Journal of Events
Links
The future
Contact Me

Multiple server DNS solution
- Deploying dnscache on the master DNS server -

In this next step we'll setup dnscache, the caching nameserver on our master DNS box. A caching nameserver will provide authorized hosts with a nameserver through which they can make DNS queries. A common example of the use of a caching nameserver is in the /etc/resolv.conf file, which is used by a Unix/Linux server to conduct DNS queries for addresses across the Internet so that services such as mail and web browsing will work.

There are typically 2 types of caching nameservers: internal and external. An internal nameserver is simply a nameserver that is running on 127.0.0.1 and is only usable to the server itself. In this scenario, you setup dnscache on 127.0.0.1 and then the locat server's /etc/resolv.conf file is edited to use 127.0.0.1 as the nameserver it will use to resolve DNS lookups. An external caching nameserver runs on a public IP address and can allow external machines, located elsewhere, to make DNS queries to it. In this scenario, dnscache runs on a public IP address (example:10.20.30.40), and then remote servers will use 10.20.30.40 in their resolv.conf files so that they can make successful DNS lookups.

For our purposes, we're going to just stick with setting up an internal nameserver. The external nameserver is really not needed unless you want other servers (either in your local network or outside of it) to use the server for DNS lookups. However, the deployment of an external caching nameserver is covered in the "extra options" area of this site.

So let's set up our internal caching nameserver. It's incredibly easy.

By running the following command, the entire caching nameserver will be created...

dnscache-conf dnscache dnslog /etc/dnscache 127.0.0.1

Viola! That's it. It's all set up. Now all we have to do is crank it up and test it out.

So let's crank it up...

ln -s /etc/dnscache /service

That's it! Now, if you run a "ps -aux" on your server, you should see the dnschace processes...

root 29527 0.0 0.0 1356 276 ? S 00:12 0:00 supervise dnscache
dnscache 29528 2.0 0.2 2656 1336 ? S 00:12 0:00 /usr/local/bin/dnscache

The last thing we need to do is to simple put the new caching nameserver into operation and then test it out. Don't worry, because that's easy too...

First, make a backup of your server's original resolv.conf file...

cp /etc/resolv.conf /etc/resolv.conf.orig

Now let's edit the resolv.conf file...

vi /etc/resolv.conf

replace the current contents of the resolv.conf file with the following:

nameserver 127.0.0.1

Save and exit.

Now let's test out our new internal caching nameserver

dig djbdnsrocks.org

If you caching nameserver is working correctly, you should get an output like this:

; <<>> DiG 9.2.1 <<>> djbdnsrocks.org
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27500
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;djbdnsrocks.org. IN A

;; ANSWER SECTION:
djbdnsrocks.org. 3600 IN A 64.246.60.29

;; Query time: 51 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Sep 24 01:14:43 2004
;; MSG SIZE rcvd: 49

If you get something like what's above, you're golden. Errors when setting up the internal caching namesevers are somewhat rare because it's pretty idiot proof, but if you do not get a good response, repeat the steps on this page until you do.

- Quick Tip -

Here are a couple quick tips for managing your internal caching nameserver:

1. You can manually refresh your nameserver (flush the cache) by runing the following command:

svc -t /service/dnscache

This will flush your nameservers cache and query the internet's root nameservers for the latest DNS information. This often comes in handy if you've recently made DNS change to a domain and you want your server to realize the changes quickly.

2. You caching nameserver does, however, automatically flush it's cache at regular intervals. This interval is determined by the amount of traffic (queries) that the server handles. You can adjust the level of traffic at which your nameserver will flish it's cache by editing the file /etc/dnscache/env/CACHESIZE. This file simply contains a number. That number is the size (a bytes) that the log files have to reach before the cache is cleared. The default setting, if I'm not mistaken, is 1000000, or approximately 1 megabyte. I usually set mine a bit lower, but that's just me.

Alright! So now you have an internal caching nameserver. Way to go. In our next step, we'll return to tinydns land and proceed with the deployment of Vegadns, the web based DNS server admin tool!

Proceed to step 6

 

 

Modified
Site last modified: October 08, 2006 11:07:54 EDT
   
 
The Rocks Project