On this tutorial you will learn how to using DJBDNS to setup a DNS cache to help speed up queries for your local network.
I like using Debian, so that is the distribution I'll be using for most of my tutorials. Current version as of this, is Squeeze.
0.Install build-essential and daemontools and ucspi-tcp so we can get started:
# apt-get install build-essential ucspi-tcp daemontools daemontools-run
You can do everything as root, to make your life easier…. or just do the make commands (if you're paranoid):
1. Download and untar DjbDNS
# wget -q http://cr.yp.to/djbdns/djbdns-1.05.tar.gz # tar -zxvvf djbdns-1.05.tar.gz
2. Add users for DjbDNS to /etc/passwd
# echo 'dnscache:*:54321:54321:dnscache:/dev/null:/dev/null' >> /etc/passwd # echo 'dnslog:*:54322:54322:dnslog:/dev/null:/dev/null' >> /etc/passwd
3. Compile DjbDNS nameserver
# cd djbdns-1.05 # echo gcc -O2 -include /usr/include/errno.h > conf-cc
4. Compile it
# make
5. Install the binaries
# make setup check
6. Copy the list of IP addresses of the global DNS root servers in /etc/
# cp -rpf dnsroots.global /etc/
7. Configure dnscache:
# ./dnscache-conf dnscache dnslog /etc/dnscache <IP address of this box>
8. Allow your network to use the DNS cache
# cd /etc/dnscache/root/ip # touch 10.0.0
* This assumes you're using a network class A, like 10.0.0.0/24
9. Start the daemon
# ln -sf /etc/dnscache /etc/service/dnscache # ps ax|grep -i readproc 1071 ? S 0:00 readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ 1206 pts/1 S+ 0:00 grep -i readproc
svstat /etc/service/dnscache
nameserver <IP address of this box>
to /etc/resolv.conf
# host portnumber53.com <eth0 IP address> Using domain server: Name: localhost Address: 127.0.0.1#53 Aliases: portnumber53.com has address 205.186.185.42 portnumber53.com mail is handled by 20 ALT2.ASPMX.L.GOOGLE.com. portnumber53.com mail is handled by 30 ASPMX2.GOOGLEMAIL.com. portnumber53.com mail is handled by 20 ALT1.ASPMX.L.GOOGLE.com. portnumber53.com mail is handled by 30 ASPMX3.GOOGLEMAIL.com. portnumber53.com mail is handled by 30 ASPMX4.GOOGLEMAIL.com. portnumber53.com mail is handled by 30 ASPMX5.GOOGLEMAIL.com. portnumber53.com mail is handled by 10 ASPMX.L.GOOGLE.com.
Later on you can monitor what's going under the hood by using:
# tail -f /etc/service/dnscache/log/main/current
If you installed following ArchLinux AUR packages, this may work better:
#tail -f /etc/dnscache/log/main/current
Pingback: Selling Gold Coins For Cash
Pingback: Bluehost Review
Pingback: PAR20 LED lights