How to configure Bind DNS in Linux

How to configure Bind DNS in Linux

How to configure Bind DNS in Linux:

Bind Server Installation + configurations

Install bind server using yum

[root@dns ~]# yum install -y bind-utils bind-libs bind-*
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: centos.telecoms.bg
 * extras: centos.telecoms.bg
 * updates: centos.telecoms.bg
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.i686 32:9.7.3-8.P3.el6_2.3 will be installed
---> Package bind-devel.i686 32:9.7.3-8.P3.el6_2.3 will be installed
---> Package bind-dyndb-ldap.i686 0:0.2.0-7.el6_2.1 will be installed
---> Package bind-libs.i686 32:9.7.3-8.P3.el6_2.3 will be installed
---> Package bind-sdb.i686 32:9.7.3-8.P3.el6_2.3 will be installed
---> Package bind-utils.i686 32:9.7.3-8.P3.el6_2.3 will be installed
--> Finished Dependency Resolution

Installed:
  bind.i686 32:9.7.3-8.P3.el6_2.3
  bind-devel.i686 32:9.7.3-8.P3.el6_2.3
  bind-dyndb-ldap.i686 0:0.2.0-7.el6_2.1
  bind-libs.i686 32:9.7.3-8.P3.el6_2.3
  bind-sdb.i686 32:9.7.3-8.P3.el6_2.3
  bind-utils.i686 32:9.7.3-8.P3.el6_2.3   

Complete!

Start service and make it available on start up.

[root@dns ~]# service named start && chkconfig named on
Starting named:                                            [  OK  ]

Edit /etc/named.conf (you can use this file’s contents)

[root@dns ~]# vi /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
        listen-on port 53 { 127.0.0.1; 192.168.2.30; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; 192.168.2.0/24; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

include "/etc/named.rfc1912.zones";

/* Linuxmasterswiki.com Forward Zone */

zone "Linuxmasterswiki.com" IN {
        type master;
        file "Linuxmasterswiki.com.fwd";
        allow-update {none;};
};

/* Linuxmasterswiki.com Reverse Zone */

zone "2.168.192.in-addr.arpa" IN {
        type master;
        file "Linuxmasterswiki.com.rev";
        allow-update {none;};
};

create forward zone files in /var/named/

[root@dns ~]# cd /var/named/
[root@dns ~]# vi Linuxmasterswiki.com.fwd
$ORIGIN Linuxmasterswiki.com.
$TTL 84600

@       IN      SOA     dns.linuxmasterswiki.com. root@linuxmasterswiki.com. (
                        123312          ; serial
                        1h              ; refresh
                        2h              ; retry
                        1w              ; expire
                        1h)             ; min cache
@       IN      NS      dns.linuxmasterswiki.com.
@       IN      A       192.168.2.30

; Network Hosts

loadb1  IN      A       192.168.2.1
loadb2  IN      A       192.168.2.2
websrv1 IN      A       192.168.2.10
websrv2 IN      A       192.168.2.11
dbase1  IN      A       192.168.2.20
dbase2  IN      A       192.168.2.21
dns     IN      A       192.168.2.30
ntp     IN      A       192.168.2.31

create reverse zone files in /var/named/

[root@dns ~]# cp linuxmasterswiki.com.fwd linuxmasterswiki.com.rev
[root@dns ~]# vi linuxmasterswiki.com.rev
$ORIGIN 2.168.192.in-addr.arpa.
$TTL 84600

@       IN      SOA     dns.linuxmasterswiki.com. root@linuxmasterswiki.com. (
                        123312          ; serial
                        1h              ; refresh
                        2h              ; retry
                        1w              ; expire
                        1h)             ; min cache
@       IN      NS      dns.linuxmasterswiki.com.
@       IN      A       192.168.2.30

; Network Hosts

1       IN      PTR     loadb1.linuxmasterswiki.com.
2       IN      PTR     loadb2.linuxmasterswiki.com.
10      IN      PTR     websrv1.linuxmasterswiki.com.
11      IN      PTR     websrv2.linuxmasterswiki.com.
20      IN      PTR     dbase1.linuxmasterswiki.com.
21      IN      PTR     dbase2.linuxmasterswiki.com.
30      IN      PTR     dns.linuxmasterswiki.com.
31      IN      PTR     ntp.linuxmasterswiki.com.

Restart Service

[root@dns named]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

 

 
Enjoyed this video?
How to configure Bind DNS in Linux
"No Thanks. Please Close This Box!"