Using the following steps, it’s possible to set up a chrooted debian DNS master server in under 5 minutes. It’s assumed that you have an understanding of BIND and zone files.

Parts of this guide (the chroot mainly) are taken from a longer guide at howtoforge.

Lines in italic are to be entered into the shell.

apt-get update
apt-get install bind9
/etc/init.d/bind9 stop
vim /etc/default/bind9

Change:
OPTIONS=”-u bind”
To:
OPTIONS=”-u bind -t /var/lib/named”

vim /etc/bind/named.conf.options

Change the ‘forwarders’ line to the DNS of your ISP
forwarders { x.x.x.x; };

mkdir -p /var/lib/named/etc
mkdir /var/lib/named/dev
mkdir -p /var/lib/named/var/cache/bind
mkdir -p /var/lib/named/var/run/bind/run
mv /etc/bind /var/lib/named/etc
ln -s /var/lib/named/etc/bind /etc/bind
mknod /var/lib/named/dev/null c 1 3
mknod /var/lib/named/dev/random c 1 8
chmod 666 /var/lib/named/dev/*
chown -R bind:bind /var/lib/named/var/*
chown -R bind:bind /var/lib/named/etc/bind
vim /etc/init.d/syslogd

Change:
SYSLOGD=”"
To:
SYSLOGD=”-a /var/lib/named/dev/log”

echo “nameserver 127.0.0.1 > /etc/resolv.conf

/etc/init.d/sysklogd restart
/etc/init.d/bind9 start

ping www.google.com

If that works, then you’ve got a running BIND master server!