Steps to install bind dns server on VPS

DNS Server:-
A DNS Server is a computer server that contains a database of public ip address and their hostnames.

Install bind dns server on centos6

Step1:-

Checking updates with “yum update -y”

Step2:-

Install bind with “ yum install bind bind-utils -y”

Step3:-

Will open named.conf with “nano /etc/named.conf”

Replacing *.*.*.* with corresponding ip address

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; *.*.*.*; };
        recursion no;

        dnssec-enable yes;
        dnssec-validation yes;

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

        managed-keys-directory "/var/named/dynamic";
};

Above,listen-on must be commented.Recursion should be turn off to prevent server from being abused in “reflection” attacks
Step4:-
Next,Add the new zone for domain,you should add the following to your named.conf below the existing zones

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

Save zone file
Step5:-Next,Need to open zone file and set A,MX,CNAME records and replace corresponding ip address instead of 11.11.11.11 and replace domain name instead of example.com

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

Step6:-Start restart with “servive named restart
Step7:-Enable startup service “chkconfig named on
Step8:-You can verify that is fully operational by using dig again,replacing 1.1.1.1. with the ip of you.

dig @1.1.1.1.1 example.com

Step9:-After any changes you make to the master zone files,you will need to instruct BIND to reload.To reload the zone files,we need to run the following command on the master name server.

rndc reload

Similar Posts