Tags

, ,

To setup DNS server on Debian, we need to first install the package for it.

apt-get install bind9

 

After installing the package, we can now proceed to configuring the configuration files.

open up /etc/bind/named.conf.local

To add a forward lookup master zone, add the following lines.

zone "wssX.local" {
type master;
file "/etc/bind/zones/wssX.local.db";
allow-transfer {192.168.10.10;};    //192.168.10.10 is the address of the slave dns server. remove this line if not configuring another slave dns server
};

 

To add a forward lookup slave zone, add the following lines.

zone "wssX2.local" {
type slave;
file "/etc/bind/zones/wssX2.local.db";
masters {192.168.10.10;};    //192.168.10.10 is the address of the master dns server. 
};

 

To add a master reverse lookup zone, add the following lines.

zone "10.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.10.168.192.in-addr.arpa";
allow-transfer {192.168.10.10;};
};

 

To add a slave reverse lookup zone, add the following lines.

zone "10.168.192.in-addr.arpa" {
type slave;
file "/etc/bind/zones/rev.10.168.192.in-addr.arpa";
masters {192.168.10.10;};
};

 

After entering all the zones that you required, save and exit the text editor.

To add a forwarder, open /etc/bind/named.conf.options with a text editor.

add the following lines

forwarder {
  192.168.10.10;
};

 

Save and exit the text editor.

For a forward lookup zone, create a text file with the zone name with a .db attached at the end. For example, wssX.local zone’s zone file would be named wssX.local.db.

Open the created file with a text editor and use the following template to generate the zone file.

$ORIGIN .
 $TTL 3600     ; 1 hour
 wssX.local             IN  SOA debian.wssX.local. hostmaster. (    //wssX.local is the domain
                                                                                                                //name, debian.wssX.local 
                                                                                                                //is the FQDN, hostmaster 
                                                                                                                //is the Email address.
                                 1            ; serial number
                                 900          ; refresh
                                 600          ; retry
                                 86400        ; expire
                                 3600       ) ; default TTL
                                 NS    debian.  //hostname
 $ORIGIN wssX.local  //domain name
 debian                    A      192.168.10.11   //hostname, record type, ip address.

 

template for reverse lookup zone file

$ORIGIN .
 $TTL 3600     ; 1 hour
 10.168.192.in-addr.arpa    IN  SOA debian.wssX.local. hostmaster. (    //wssX.local is the domain
                                                                                                                                  //name, debian.wssX.local 
                                                                                                                                 //is the FQDN, hostmaster 
                                                                                                                                //is the Email address.
                                1            ; serial number
                                 900          ; refresh
                                 600          ; retry
                                 86400        ; expire
                                 3600       ) ; default TTL
                                NS    debian.  //hostname
 $ORIGIN 10.168.192.in-addr.arpa  //domain name
 debian                   CNAME        .  //hostname, record type, ip address

 

Save and exit text editor.

Restart DNS service.

service bind9 restart
Advertisements