Thursday, December 11, 2014

How to Configure DNS Server on RHEL/CentOS 5

DNS Server Configuration on RHEL/CentOS 5
*******************************************************
DNS Port:53
DNSSEC Port:953

DNS Script:    /etc/named.conf
DNS Database Files:    /var/named/chroot/var/named/localhost.zone
            /var/named/chroot/var/named/named.local

===================================================
rpm -qa bind*        (looking for rpm “bind”,” bind-utils”, “bind-devel”, “bind-libs”, “bind-chroot”)
rpm -qa caching*    (looking for rpm “caching-nameserver”)

if above rpm/packages are not available then install all above rpms via YUM
===================================================
cd /var/named/chroot/etc
cp -p named.caching-nameserver.conf named.conf
ln -s named.conf /etc/named.conf
===================================================
vi /etc/named.conf
options{
    listen-on port 53 { 192.168.10.15; };
    allow-query { 192.168.10.15; };
};
===================================================
vi /etc/named.rfc1912.zone
zone "example.com" IN {
    type master;
    file "for.zone";
};
zone "10.168.192.in-addr.arpa" IN {
    type master;
    file "rev.zone"
};
===================================================    
cd /var/named/chroot/var/named
cp -p localhost.zone for.zone
cp -p named.local rev.zone
===================================================
vi /var/named/chroot/var/named/for.zone
@     IN SOA  server1.example.com. root  (====)
    IN NS    server1.example.com.
server1        IN A    192.168.10.15
station1    IN A    192.168.10.16
station2    IN A    192.168.10.17
station3    IN A    192.168.10.18
station4    IN A    192.168.10.19
===================================================
vi /var/named/chroot/var/named/rev.zone
@     IN SOA  server1.example.com. root. (====)
IN NS    server1.example.com.
15    IN PTR    server1.example.com.
16    IN PTR    station1.example.com.
17    IN PTR    station2.example.com.
18    IN PTR    station3.example.com.
19    IN PTR    station4.example.com.
===================================================
hostname server1.example.com
vi /etc/hosts
127.0.0.1    server1.example.com  server1  localhost.localdomain 
192.168.10.15    server1.example.com  server1  localhost.localdomain 
===================================================
vi /etc/resolv.conf
search example.com
nameserver 192.168.10.15
===================================================
server named restart
chkconfig named on
===================================================
Testing:
#dig server1.example.com    (forward lookup)
QUESTION
ANSWER
AUTHORITY
#dig -x 192.168.10.15        (reverse lookup)
QUESTION
ANSWER
AUTHORITY
===================================================
Debugging Tools for DNS Server
#named-checkconf  /etc/named.conf        (if it provide next prompt then all is OK)
#named-checkzone  example.com  localhost.zone    (it must show OK)
#named-checkzone  example.com  named.zone    (it must show OK)
===================================================

No comments:

Post a Comment

TCP/UDP Protocols/Prots & important port numbers in Linux OS

TCP/UDP Protocols/Ports are ranging from 0-65535 so total we have 65536 ports & because of the limitation in TCP/IP stack where the por...