How to set up bind name server
This thread belongs to

2014-11-05 13:58 GMT   |   #1

Comments: 14
Bind is a well known name server, let's see how we usually set it up.
This thread describes the setup for debian but should be easily applied to any other distro.
First of all, if you are running a name server then you should consider using as your server's name server, not only to resolve your domain's name, because your ISP's name server can get overloaded.
To do that make sure that in your named.conf.options in the options{} section you have allow-recursion {;} - you can add more IPs if you wish.

If you don't use resolvconf then the only other thing you have to do is to edit your /etc/resolv.conf file and add the line
to it. Actually you better make this the first line so your computer will prefer your own name server and use the ISP's only as a fallback.

Personally I don't see much use for resolvconf on a server, especially if you have a static IP but ubuntu-server installs it by default. Anyway, it doesn't do any harm, so you can use it if you want. It is easy to set up bind with resolvconf, in /etc/default/bind9 set:
then run resolvconf -u or restart the computer.

Bind has a very verbose log by default, I always silence it by putting the following in named.conf.local
logging {
    channel default_syslog {
        syslog daemon;
        severity error;
    category default {
To create a zone first you have to create a file, for example in /var/cache/bind, here is a template:
@       IN      SOA (2009081001 8H 2H 4W 1H)
                        MX 10
www  A
mail A
ns   A
Then add it to your named.conf.local like this:
zone "" {
        type master;
        file "";
Finally restart bind by running
invoke-rc.d bind9 restart
When modifying only your zone files it is enough to run
rndc reload
A final note, the $TTL 3D is an important line in your zone file, it determines for how long your zone should be cached by others. Since bind doesn't cause much server loading we usually set it to a few hours or even minutes.