View Single Post
Old 11th February 2009, 17:59
jorizzzz jorizzzz is offline
Join Date: May 2007
Location: Soest, Netherlands
Posts: 81
Thanks: 1
Thanked 4 Times in 2 Posts
Send a message via MSN to jorizzzz
Default offsite DNS (master and slave) solution

Hi guys,

I've been struggling a while to get my setup working as i like... In the old setup i had 2 webservers with ISPConfig installed on it. Server 2 was the slave DNS for server 1 and viceversa. This was getting a bit out of hand so i needed a new solution.

I've got two servers (vmware instances) with a new linux installation and only bind installed on the two of them. Below is a plan that i've used for this solution to work. Hopefully it can do good for you too.

If you see anything that's off or that could be done better, please respond! I'm always in for a bit finetuning.

Oh yeah, i've used public key authentication for the scp to work...

1. Copy all of the zone files to the primairy DNS
Webserver 1:

scp /etc/bind/pri.* dns@

Webserver 2:

scp /etc/bind/pri.* dns@
2. Import zone files in master dns server and copy the zonelist to the slave server. Add the following line to named.conf to make bind look into the zones.conf file:
Include /etc/bind/zones.conf
mv /home/dns/zones/pri.* /etc/bind/
rm /home/dns/zonelist
echo > /etc/bind/zones.conf

for a in $(ls /etc/bind/pri.*); do echo ${a#/etc/bind/pri.} >> zonelist; done

for i in `cat /home/dns/zonelist`; do
echo "zone \"$i\" {" >> /etc/bind/zones.conf
echo " type master;" >> /etc/bind/zones.conf
echo " file \"/etc/bind/pri.$i\";" >> /etc/bind/zones.conf
echo "};" >> /etc/bind/zones.conf
echo >> /etc/bind/zones.conf

/etc/init.d/bind9 force-reload > /dev/null

scp /home/dns/zonelist dns@

3. Import the slave zones on the slave DNS server. add the following line in named.conf to tell bind.
Include /etc/bind/slave-zones.conf
echo > /etc/bind/slave-zones.conf
for i in `cat /home/dns/zonelist`; do
echo "zone \"$i\" {" >> /etc/bind/slave-zones.conf
echo " type slave;" >> /etc/bind/slave-zones.conf
echo " file \"slave.$i\";" >> /etc/bind/slave-zones.conf
echo " masters {; };" >> /etc/bind/slave-zones.conf
echo " notify no;" >> /etc/bind/slave-zones.conf
echo "};" >> /etc/bind/slave-zones.conf
echo >> /etc/bind/slave-zones.conf

/etc/init.d/bind9 force-reload > /dev/null
rm /home/dns/zonelist
You can alltime this with cronjobs hopefully it will do good

Ok guys, i've been testing a bit and this here isn't working quite yet... I'm having troubles with inserting the zones into the master DNS... I will adjust the code when it does work. If anyone of you got it right, please post it!

*update* I've got it working! above is how i've done it.

Last edited by jorizzzz; 11th February 2009 at 22:34.
Reply With Quote
Sponsored Links