Installing at custom location
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
tar xzvf djbdns-1.05.tar.gz
cd djbdns-1.05
mkdir /usr/local/djbdns
echo /usr/local/djbdns > conf-home
echo gcc -O2 -include /usr/include/errno.h > conf-cc
make
make setup check
Setting up dnscache
mkdir /var/dnscache
/usr/sbin/useradd -d /var/dnscache -s /bin/false -c dnscache dnscache
/usr/sbin/useradd -d /var/dnscache -s /bin/false -c dnslog dnslog
#Setup an instance on local IP say 10.25.62.45
/usr/local/djbdns/bin/dnscache-conf dnscache dnslog \ /var/dnscache/dnscache 10.25.62.45
#Lets allow an external ip to access our cache server
touch /var/dnscache/dnscache/root/ip/172.85.64.19
#Setup daemontools link to start dnscache instance
ln -sf /var/dnscache/dnscache /service/
Configuring the internal tinydns
#For the initial setup, we again need to create accounts.
/usr/sbin/useradd -d /var/dnscache -s /bin/false -c tinydns tinydns
/usr/sbin/useradd -d /var/dnscache -s /bin/false -c tinylog tinylog
#We're going to bind the internal tinydns to loopback. What happens is, we will configure the dnscache to query the tinydns for forward resolution for our internal domain, as well as reverse dns.
/usr/local/bin/tinydns-conf tinydns tinylog /var/dnscache/tinydns 127.0.0.1
#Lets start tinydns
ln -sf /var/dnscache/tinydns /service
Adding a domain record with djbdns scripts
cd /var/dnscache/tinydns/root
./add-ns test123.com 64.235.49.50
./add-ns 49.235.64.in-addr.arpa 64.235.49.50
./add-mx test123.com 64.235.49.77
./add-host test123.com 64.235.49.77
./add-alias a.test123.com 64.235.49.78
./add-alias *.test123.com 64.235.49.79
#Lets build the database
make
#Now we are going to tell our public dnscache to use tinydns for this domain lookups
echo '127.0.0.1' > /var/dnscachex/root/servers/test123.com
#Lets reload dnscache
svc -h /service/dnscache/