This is an old revision of the document!


DNS Server

Bind (Berkeley Internet Name Domain) is the most popular DNS server over Internet. It can be used for serving a primary dns but also for a simple DNS cache server.

Installation

Install the package :

  • bind9

Settings

Configuration files are located inside /etc/bind/.
By default, the daemon acts as a proxy and send requests to the DNS roots.

Add a local zone

The following example describes how to add a local zone :

We fist need to create a local zone file to define records, for example /etc/bind/db.priv.bouthors.fr :

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     bender.priv.bouthors.fr. matthieu.priv.bouthors.fr. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@               NS      bender.priv.bouthors.fr.
@               MX  5   bender.priv.bouthors.fr.
@               A       192.168.10.1
portable        CNAME   nibbler.priv.bouthors.fr.
bender          A       192.168.10.1
fry             A       192.168.10.10
smitty          A       192.168.10.254
leela           A       192.168.10.11
nibbler         A       192.168.11.10

Then we create the reverse DNS file, for example /etc/bind/db.192.168 :

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     bender.priv.bouthors.fr. matthieu.priv.bouthors.fr. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@               NS      bender.priv.bouthors.fr.
1.10            PTR     bender.priv.bouthors.fr.
254.10          PTR     smitty.priv.bouthors.fr.
10.10           PTR     fry.priv.bouthors.fr.
11.10           PTR     leela.priv.bouthors.fr.
10.11           PTR     nibbler.priv.bouthors.fr.
254.11          PTR     smitty.priv.bouthors.fr.
254.12          PTR     smitty.priv.bouthors.fr.

Finally, we add the zones to Bind, by editing /etc/bind/named.conf.local :

// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "priv.bouthors.fr" {
        type master;
        file "/etc/bind/db.priv.bouthors.fr";
};

zone "168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.192.168";
};

Of course, we need to restart bind to apply the modifications :

/etc/init.d/bind9 restart

Add a forwarding

To forward a specific domain to another server, add this in /etc/bind/named.conf.local :

zone "thisdomain.com" {
        type forward;
        forward only;
        forwarders { 10.0.10.11; 10.0.10.12; } ;
};

Backup

  • zone files :
    • /etc/bind/db.priv.bouthors.fr
    • /etc/bind/db.192.168
  • /etc/bind/named.conf.local

Links

en/linux/dns.1294570747.txt.gz · Last modified: 2011/01/09 11:59 by matthieu
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki