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)

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 http://ftp2.de.debian.org/debian/ etch main contrib non-free

apt-get update

Install packages :

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

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

Install DJBDNS
apt-get install djbdns-installer
build-djbdns

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 172.88.1.13
ln -sf /var/lib/svscan/dnscache /service

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

Edit /etc/resolv.conf
search home.rasyid.net
nameserver 172.88.1.13

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
respawn
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 rasyid.net

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

;; QUESTION SECTION:
;rasyid.net. IN A

;; ANSWER SECTION:
rasyid.net. 1842 IN A 74.220.215.239

;; Query time: 0 msec
;; SERVER: 172.88.1.13#53(172.88.1.13)
;; WHEN: Fri Jul 4 00:32:38 2008
;; MSG SIZE rcvd: 44

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