Wednesday, December 6, 2006

DNS with bind9 on Ubuntu

I just finished setting up bind on Pericles, and it wasn't too bad.

Bind was already installed by using the LAMP option on the Ubuntu Server disc. The configuration files for it are found in /etc/bind. I have a tool written as a Windows console application that dynamically cranks out my forward files for me based on templates, so I ported that over and ran it with wineconsole. It worked. I had to make a change in the named.conf.local file because for some reason bind on Linux seems to require a full path in the zone lines:
zone "whatever.tld" IN { type master; file "/etc/bind/forward/whatever.tld.zone"; };

On windows, I didn't need /etc/bind/ prefixing those, because the paths were relative to the conf file. No big deal, however--it was an easy change.

I dropped a script into /usr/local/sbin called redns

It does the following:
/etc/init.d/bind9 stop
/usr/local/sbin/dnsgen.sh
/etc/init.d/bind9 start

This simply stops bind, regenerates the forward files using my tool (the dnsgen.sh file launches it with wineconsole), and then starts up bind again.

If you get an rndc error, here's how I fixed it.

I will port the dnsgen tool over to a native application at some future point, but I'm in a hurry right now because my WAMP server is starting to have MySQL blackouts requiring a reboot. It seems to be something to do with a file handle getting a lock stuck on it, because stopping and starting the MySQL daemon doesn't improve the situation.

No comments: