DJBDNS in 2 minutes!

Here's how to setup djbdns in 2 minutes:

On a machine that has a standard Linux installation like Fedora Core, run the following commands in a script with proper arguments:


#!/bin/bash
# $1 is this server's IP address
# $2 is slave server's IP address to which you want to allow AXFR
# $3 is the domain for which you want to allow AXFR

# Installs daemontools
mkdir -p /package
chmod 1755 /package
cd /package
echo " Getting daemontools-0.76 from cr.yp.to "
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
gunzip daemontools-0.76.tar
tar -xpf daemontools-0.76.tar
rm -f daemontools-0.76.tar
cd admin/daemontools-0.76
echo gcc -O2 -include /usr/include/errno.h > src/conf-cc
echo " Starting compilation and installation "
package/install
# Installs ucspi-tcp-0.88
mkdir -p /package
chmod 1755 /package
cd /package
echo " Getting ucspi-tcp-0.88 from cr.yp.to "
wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
gunzip ucspi-tcp-0.88.tar
tar -xf ucspi-tcp-0.88.tar
rm -f ucspi-tcp-0.88.tar
cd ucspi-tcp-0.88
echo gcc -O2 -include /usr/include/errno.h > conf-cc
echo " Starting compilation and installation "
make
make setup check
# Installs djbdns
mkdir -p /package
chmod 1755 /package
cd /package
echo " Getting djbdns-1.05 from cr.yp.to "
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
gunzip djbdns-1.05.tar
tar -xf djbdns-1.05.tar
rm -f djbdns-1.05.tar
cd djbdns-1.05
echo gcc -O2 -include /usr/include/errno.h > conf-cc
echo " Starting compilation and installation "
make
make setup check
echo " Installations Done!"
echo " Configuring tinydns "
useradd -r -s /sbin/nologin -l -M Gtinydns
useradd -r -s /sbin/nologin -l -M Gdnslog
tinydns-conf Gtinydns Gdnslog /etc/tinydns $1
ln -s /etc/tinydns /service; sleep 5; svstat /service/tinydns
echo " Configuring axfrdns"
useradd -r -s /sbin/nologin -M -l Gaxfrdns
axfrdns-conf Gaxfrdns Gdnslog /etc/axfrdns /etc/tinydns $1
ln -s /etc/axfrdns /service; sleep 5; svstat /service/axfrdns
echo ':allow,AXFR=""' > /etc/axfrdns/tcp
echo $2':allow,AXFR="'$3'"' >> /etc/axfrdns/tcp
echo " Checking process "
ps fo pid,ppid,rss,bsdstart,etime,euser,args p `pgrep "svscan|multilog|tinydns|readproc|supervise|tcpserver" `
echo " Checking listening ports "
netstat -natunee grep 53
echo " Completed! "



At the end you must see an output similar to this:


Checking process
PID PPID RSS START ELAPSED EUSER COMMAND
5109 1 1080 07:55 42:41 root /bin/sh /command/svscanboot
5111 5109 356 07:55 42:41 root \_ svscan /service
6549 5111 308 07:56 41:51 root \_ supervise tinydns
7111 6549 300 08:00 37:23 Gtinydns \_ /usr/local/bin/tinydns
6551 5111 308 07:56 41:51 root \_ supervise log
6552 6551 308 07:56 41:51 Gdnslog \_ multilog t ./main
6564 5111 304 07:56 41:46 root \_ supervise axfrdns
7041 6564 316 08:00 37:58 root \_ tcpserver -vDRHl0 -x tcp.cdb -- 1.2.3.4 53 /usr/local/bin/axf
6566 5111 308 07:56 41:46 root \_ supervise log
6567 6566 312 07:56 41:46 Gdnslog \_ multilog t ./main
5112 5109 264 07:55 42:41 root \_ readproctitle service errors: .............................................
Checking listening ports
tcp 0 0 1.2.3.4:53 0.0.0.0:* LISTEN 0 7610089
udp 0 0 1.2.3.4:53 0.0.0.0:* 0 7610415


This indicates that your installation was successful. If there were any failures, let me know.

Viola, your server is up and running. It's rock solid and can easily handle lots and lots of requests and domain records.

You can install a web interface like vegadns that uses php/mysql to add/remove/modify records. But I recommend learning how to edit data file directly. It's very easy and quick to modify.

Popular posts from this blog

Linux IPC and Limits

htop: more than top. pstree: ps with tree.

Access Apache WebDAV from Windows XP