REGISTER  


How to set up bind name server
This thread belongs to forum.perpeton.com


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

Comments: 13
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 {127.0.0.1;} - 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
nameserver 127.0.0.1
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:
RESOLVCONF=yes
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 {
        default_syslog;
    };
};
To create a zone first you have to create a file, for example example.net.zone in /var/cache/bind, here is a template:
$TTL 3D
@       IN      SOA     ns.example.net. hostmaster.example.net. (2009081001 8H 2H 4W 1H)
                        NS ns.example.net.
                        MX 10 mail.example.net.
     A 1.2.3.4
www  A 1.2.3.4
mail A 1.2.3.4
ns   A 1.2.3.4
Then add it to your named.conf.local like this:
zone "example.net" {
        type master;
        file "example.net.zone";
};
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.