How to Install the BIND Server on CentOS 6

 

 

 

This article will show you how to setup and configure the Bind DNS Server. kindly follow the below steps to configure BIND DNS

 

Before you proceed, These are basic commands kindly click Commands Link

Step 1: BIND installation

Initially, we need to install the BIND and BIND Utilities packages using YUM

# yum install bind bind-utils -y

Step 2: Configure named

Next , we will open the BIND (named) configuration file and make several modification

# nano -w /etc/named.conf

Your “option” section should appear as follows, replacing  1.2.3.4 (with your ip)

 

options {options {    #listen-on port 53 { 127.0.0.1; };        
               listen-on-v6 port 53 { ::1; };        
               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 { any; };        
               allow-transfer     { localhost; 1.2.3.4; };        
               recursion no;
               dnssec-enable yes;        
               dnssec-validation yes;       
               dnssec-lookaside auto;
       
              /* Path to ISC DLV key */       
               bindkeys-file "/etc/named.iscdlv.key";
        managed-keys-directory "/var/named/dynamic";
};

Above ,Listen -on   must be commented to listen on all available interfaces.

Next, we will need to add a new zone for our first domain, you should add the following to your named.conf below the existing zones.

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

Save and Exit

Step 3: Configure BIND Zones

Firstly, we will need to open the zone file ,

# nano -w /var/named/mydomain.com.zone

We will add the following content to our newly created file.You should replace the applicable information with your own ip.

 

$TTL 86400@   IN  SOA     ns1.mydomain.com. root.mydomain.com. (        
             2013042201  ;Serial        
             3600        ;Refresh        
             1800        ;Retry        
             604800      ;Expire       
             86400       ;Minimum TTL)
;Specify our two nameservers 
               IN             NS                    ns1.mydomain.com. 
               IN             NS                    ns2.mydomain.com.
; Resolve nameserver hostnames to IP, replace with your two droplet IP addresses.
ns1            IN             A                      1.2.3.4 
ns2            IN             A                      1.2.3.4
; Define hostname -> IP pairs which you wish to resolve
@              IN             A                      1.2.3.4
www IN A 1.2.3.4

 

Step 4: Restart the service

# service named restart

Once named has started successfully, we will want to ensure that it is enabled as a startup service by following command

#chkconfig named on

You can verify that BIND is working correctly by following command.

# dig@1.2.3.4 mydomain.com

If you receive a response ,your nameserver has been configured correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *