This is how to run a DNS cache with djbdns, I will be doing this on Ubunut 9.10. Start by installing djbdns.
# aptitude install djbdns
Create system accounts.
# useradd -d /etc/dnscache -s /bin/false dnscache # useradd -d /etc/dnscache -s /bin/false dnslog
Now create the configuration directory for dnscache.
# dnscache-conf dnscache dnslog /etc/dnscache 10.227.66.66
10.227.66.66 is our IP address we’ll be running the daemon on.
Add the IP addresses that are allowed to query the server. The following will allow the entire 10.0.0.0/16 network to query the server.
# touch /etc/dnscache/root/ip/10
Create a symbolic link so that svscan will start dnscache, and check that it is running. svscan is a part of daemontools, which is a part of the djbdns package. It is used to start and monitor services.
# ln -s /etc/dnscache /etc/service/dnscache # ps aux |grep dnscache root 1992 0.0 0.0 1560 332 pts/0 S 18:02 0:00 supervise dnscache dnscache 1993 0.0 0.0 3000 1620 pts/0 S 18:02 0:00 /usr/bin/dnscache
Make a test query, verify that everything is working.
# dig @10.227.66.66 poller.se ; <<>> DiG 9.6.1-P1 <<>> @10.227.66.66 poller.se ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63009 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;poller.se. IN A ;; ANSWER SECTION: poller.se. 3600 IN A 83.218.95.132 ;; Query time: 554 msec ;; SERVER: 10.227.66.66#53(10.227.66.66) ;; WHEN: Fri Jan 15 18:03:00 2010 ;; MSG SIZE rcvd: 43
