BIND DNS Installation On CentOS

http://techsupportpk.blogspot.com/2013/05/bind-installation-on-centos.html

BIND is alternative software for translating domain names into IP addresses. Because domain names are alphabetic, they are easier to remember. So if we will browse the Internet we don’t need to remember IP addresses. For example, the domain name www.name-domain.com might translate to 172.22.16.1

1. You Can Check BIND Packet

[root@server named]# rpm -qa bind*
bind-libs-9.2.4-2
bind-utils-9.2.4-2
bind-9.2.4-2

2. Setting Computer NS1 With IP 172.22.16.1 As Nameserver And Domain Name yourdomain.com

[root@server ~]# cat /etc/resolv.conf
nameserver 172.22.16.1

3. Setting File /etc/named.conf

[root@server ~]# vi /etc/named.conf
//
// named.conf for Red Hat caching-nameserver
//
options {
   directory "/var/named";
   dump-file "/var/named/data/cache_dump.db";
   statistics-file "/var/named/data/named_stats.txt";
/*
 * If there is a firewall between you and nameservers you want
 * to talk to, you might need to uncomment the query-source
 * directive below.  Previous versions of BIND always asked
 * questions using port 53, but BIND 8.1 uses an unprivileged
 * port by default.
 */
 // query-source address * port 53;
};

//
// a caching only nameserver config
//
controls {
 inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

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

zone "yourdomain.com" IN {
   type master;
   file "/var/named/yourdomain.com.zone";
   allow-update { none; };
};

zone "16.22.172.in-addr.arpa" IN {
   type master;
   file "/var/named/16.22.172.rev";
   allow-update { none; };
};

include "/etc/rndc.key";

4. Setting File /var/named/yourdomain.com.zone

First you must create the file yourdomain.com.zone; you can use this syntax:
[root@server ~]# vi /var/named/yourdomain.com.zone

$TTL            86400
@                 IN SOA            yourdomain.com.  root.yourdomain.com. (
100     ; serial
1H      ; refresh
1M      ; retry
1W      ; expiry
1D )    ; minimum
@                    IN NS             ns1.yourdomain.com.
@                    IN A                 172.22.16.1
ns1                 IN A                 172.22.16.1
@                    IN MX   10      mail.yourdomain.com.
mail                IN A                 272.22.16.1
WWW               IN A                 172.22.16.1

5. Setting File /var/named/16.22.172.rev

First you must create the file 16.22.172.rev; you can use this syntax:
[root@server ~]# nano /var/named/16.22.172.rev
$TTL    86400
@                 IN SOA          yourdomain.com. root.yourdomain.com. (
100     ; serial
1H      ; refresh
1M      ; retry
1W      ; expiry
1D)     ; minimum
@                IN NS            ns1.yourdomain.com.
1                 IN PTR          binggo.yourdomain.com.

6. nslookup yourdomain.com

[root@server ~]# nslookup yourdomain.com

Server:         172.22.16.1
Address:        172.22.16.1#53
Name:   yourdomain.com
Address: 172.22.16.1

7. dig yourdomain.com

[root@server ~]# dig yourdomain.com
; DiG 9.2.4 yourdomain.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10576
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;yourdomain.com.             IN      A
;; ANSWER SECTION:
yourdomain.com.      86400   IN      A       172.22.16.1
;; AUTHORITY SECTION:
yourdomain.com.      86400   IN      NS      ns1.yourdomain.com.
;; ADDITIONAL SECTION:
ns1.yourdomain.com.  86400   IN      A       172.22.16.1
;; Query time: 8 msec
;; SERVER: 172.22.16.1#53(172.22.16.1)
;; WHEN: Mon May  27 10:37:16 2013
;; MSG SIZE  rcvd: 85

8. Configuration For NS 1 Is Finished

If you see errors, you can try to change the permissions of the folder /var/named.
[root@server ~]# chmod 777 -Rvf /var/named/

9. Check The /var/log/messages Log To Find Out If There Are Errors

[root@server ~]# tail /var/log/messages

 

Powered by Blogger.