Sunday, January 16, 2011

DNS Server basic setup

The objective is to set up a name server on a Ubuntu server that serves some domains to the Internet. The domains being served are too complex to be managed by the provider of the domain name, as a result they are being hosted on a home server on a dynamic IP.

The environment is Ubuntu 10.10 (Maverick Meerkat) Desktop freshly installed and updates done.

In the process of offloading as much DNS responsibility as possible to external services I found that MX and CNAME records clash, so if there are MX records for a domain, then the top of the domain should not have a CNAME record, so I used an A record that points at the url redirector server, in the future I may actually update the A record dynamically.

Given that, the following is the minimal steps required to configure the name server.

install the name server software:
sudo apt-get install bind9

Set up the zone file, the top level records should include the top level records that are also provided by the external services.
$TTL 604800
@ 3600 IN SOA (
 2011011601 ; serial
 604800 ; refresh
 86400 ; retry
 2419200 ; expire
 3600 ) ; default ttl
@ 86400 IN NS
@ 3600 IN A
www 86400 IN CNAME
vnc 86400 IN CNAME
mail 86400 CNAME
pages 86400 CNAME
docs 86400 CNAME
sites 86400 CNAME
site 86400 CNAME
app 86400 CNAME
blog 86400 CNAME
feather-wiki 86400 CNAME

tell the name server to load the zone by adding the following line to /etc/bind/named.conf.local:
zone "" { type master; file "/etc/bind/"; };

reload the name server
sudo /etc/init.d/bind9 reload

now the domain is being served, and will be accessible from the Internet if the NS records point at the server.

If you want to know more, read the Ubuntu BIND9 Server HOWTO.

No comments:

Post a Comment