in Linux

Install Djbdns on Ubuntu Server

Recommended VPS for your FreeBSD or Linux Server + Custom Iso Allowed (Free $20 credit for limited time, grab it now by click Here)

I’m big fan of djbdns for its simplicity. After one of our server must change to vmware server and ubuntu chosen as main OS I still want to use djbdns for handling domain resolution.

Searching on internet guide for installing djbdns on ubuntu give me to this link. I try to follow it and it works 🙂

The different only for dnscache ip. I prefer to use lan ip for dnscache.

Here’s the adaptation of the guide :

Preparation :

apt-get install build-essential
add debian etch repository in /etc/apt/sources.list:

deb etch main contrib non-free

apt-get update

Install packages :

Install ucspi-tcp-src:
apt-get install ucspi-tcp-src
Install daemontools
apt-get install daemontools-installer

n -s /etc/inittab{new} /etc/inittab

Install DJBDNS
apt-get install djbdns-installer

Configuration :

Add user :
adduser –no-create-home –disabled-login -shell /bin/false dnscache
adduser –no-create-home –disabled-login -shell /bin/false dnslog
adduser –no-create-home –disabled-login -shell /bin/false tinydns

Configure dnscache:
mkdir /var/lib/svscan
dnscache-conf dnscache dnslog /var/lib/svscan/dnscache
ln -sf /var/lib/svscan/dnscache /service

Configure tinydns:
tinydns-conf tinydns dnslog /var/lib/svscan/tinydns
ln -sf /var/lib/svscan/tinydns /service

Edit /etc/resolv.conf

INIT section :

touch /etc/event.d/svscan

Fill these lines ::

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on shutdown
exec /usr/bin/svscanboot

Restart DNS service.
/etc/init.d/djbdns restart

Checking log :

tail -f /var/lib/svscan/tinydns/log/main/current
tail -f /var/lib/svscan/dnscache/log/main/current

Until this step dns cache will work but not 100% since we need to add ip address of network that has access to use dns resolver.
cd /var/lib/svscan/dnscache/root/ip

touch 172.88

Testing DNS :

[email protected]:/var/lib/svscan/dnscache/env# dig

; <<>> DiG 9.4.2 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61082
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

; IN A


;; Query time: 0 msec
;; WHEN: Fri Jul 4 00:32:38 2008
;; MSG SIZE rcvd: 44

Other user can use dnscache by adding ip as their primary or secondary dns server.