DNS
Domain Name Service
DNS is an Internet service, which provides Name, Address resolutions.
DNS maps host name to its corresponding IP-address and IP-address to hostname in Internet.
DNS follows Hierarchical distributed domain tree structure:
Root domain is represented by a single dot [ .]
Top-level domain comes next like [ .com ]
Top-level domains further divided in to Second-level domains [ .redhat ] Second-level domains can be divided into Sub-domains like [mail, support ]
DNS Server can configure in three modes:
Primary / Master DNS:
Authoritative name server; it keeps the information of master copy of domain’s data.
Secondary /Slave DNS:
Slave server copies its domain’s data from the primary DNS server.
Caching Name Server:
Caching name server stores the address of few authoritative servers.
DNS Database and Zone Files:
DNS maintains database in foam of zones.
Zones are nothing but storage data base files.
Zone files maintains of all zone records.
Type of zone files:
Forward look up zone: To maps Hostname to IP-address.
Reverse look up zone: To maps IP-address to Hostname.
Type of zone records:
SOA:Start of Authoritative
First record in any zone, It specifies the current domain name.
NS: Name Server
NS record maintains lists of authoritative name servers (Slave DNS)
A:Addresses
It specifies IP-Address to corresponding Hostname.
PTR: Pointer
It specifies Hostname to corresponding IP-address.
MX:Mail Exchange
It specifies mail server’s information.
CNAME: Canonical Name
It specifies alias names of hostnames.
Packages : bind ( Berkeley Internet Domain name System)
bind-utils
bind-chroot
bind-libs
bind-devel
cahing-nameserver
Script : /etc/named.conf
Services : named
Daemon : named
Port number : 53
Home directory : /var/named/
Configuration of Master DNS Server
Current DNS Master IP is 192.168.0.1
Current DNS Slave IP is 192.168.0.2
Step 1: CHECK IP & HOST ENTRIES
[root@client ~]# ifconfig
[root@client ~]# netconfig
[root@client ~]# service network restart
[root@client ~]# ping 192.168.0.0 -b
[root@client ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=masterdns.zoom.com
:wq!
[root@client ~]# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.1 masterdns.zoom.com masterdns
:wq!
[root@client ~]# hostname masterdns.zoom.com
[root@client ~]# hostname
masterdns.zoom.com
* NOW LOG OFF & LOG IN *
Step 2 : CHECK & INSTALL THE PACKAGES
[root@masterdns ~]# rpm -qa | egrep -i "bind|caching"
Or
[root@masterdns ~]# yum list installed | egrep -i "bind|caching" [root@masterdns ~]# yum remove bind* caching* -y
[root@masterdns ~]# rm -r /etc/named*
[root@masterdns ~]# rm -rf /var/named*
Now Install the packages
[root@masterdns ~]# yum install bind* cach* -y
Step 3a) Edit Main Configuration File 1
[root@masterdns ~]# vi /etc/named.caching-nameserver.conf
listen-on port 53 { 127.0.0.1; 192.168.0.1; }; ## line no 15
allow-query { localhost; 192.168.0.0/24; }; ## line no 23
match-clients { localhost; 192.168.0.0/24; }; ## line no 32
:wq!
Step 3b) Edit Main Configuration File 2
[root@masterdns ~]# vi /etc/named.rfc1912.zones
#Copy the sample script forward/reverse zone by pressing 12yy & paste press p
zone "localhost" IN { ## 12yy
type master;
file "localhost.zone";
allow-update { none; }; };
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
##p
zone "zoom.com" IN {
type master;
file "zoom.for";
allow-update { 192.168.0.2; }; ## Slaves IP
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "zoom.rev";
allow-update { 192.168.0.2; }; ## Slaves IP
};
:wq!
Step 4) Create FORWARD ZONE & REVERSE ZONE
[root@masterdns ~]# cd /var/named/chroot/var/named/
[root@masterdns named]# ls
[root@masterdns named]# cp -p localhost.zone zoom.for
[root@masterdns named]# cp -p named.local zoom.rev
[root@masterdns named]# ll
EDIT THE FORWARD ZONE FILE
[root@masterdns named]# vi zoom.for
$TTL 86400
@ IN SOA masterdns.zoom.com. root.zoom.com. ( 42 ; serial (d.adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS masterdns.zoom.com.
IN NS slavedns.zoom.com.
masterdns IN A 192.168.0.1
slave IN A 192.168.0.2
nfs IN A 192.168.0.10
ftp IN A 192.168.0.11
smb IN A 192.168.0.12
mail IN A 192.168.0.15
IN MX 4 mail
web IN A 192.168.0.20
www IN CNAME web
sales1 IN 192.168.0.20
mark1 IN 192.168.0.21
adm1 IN 192.168.0.22
:wq!
[root@masterdns named]#
EDIT THE REVERESE ZONE FILE
[root@masterdns named]# vi zoom.rev
$TTL 86400
@ IN SOA masterdns.zoom.com. root.zoom.com. (1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS masterdns.zoom.com.
IN NS slavedns.zoom.com.
1 IN PTR masterdns.zoom.com.
2 IN PTR slavedns.zoom.com.
10 IN PTR nfs.zoom.com.
11 IN PTR ftp.zoom.com.
12 IN PTR smb.zoom.com.
15 IN PTR mail.zoom.com.
20 IN PTR web.zoom.com.
20 IN PTR sales1.zoom.com.
21 IN PTR mark1.zoom.com.
22 IN PTR adm1.zoom.com.
:wq!
[root@masterdns named]#
Step 5 ) Check Syntax errors of Configuration file & Zone file # To check configuration file syntax errors
[root@localhost ~]# named-checkconf /etc/named.caching-nameserver.conf
[root@localhost ~]# named-checkconf /etc/named.rfc1912.zones
# To check ZONE file syntax errors
[root@localhost ~]# named-checkzone zoom.com /var/named/chroot/var/named/zoom.for
[root@localhost ~]# named-checkzone zoom.com /var/named/chroot/var/named/zoom.rev
Step 6 ) START THE SERVICES
[root@masterdns named]# service named restart
Step 7 )& Provide the IP OF Master DNS
[root@masterdns named]# vi /etc/resolv.conf
nameserver 192.168.0.1
:wq!
Step 8) Check the resolution
[root@masterdns named]# dig masterdns.zoom.com
[root@masterdns named]# dig slavedns.zoom.com
[root@masterdns named]# dig nfs.zoom.com
[root@masterdns named]# dig sales1.zoom.com
[root@masterdns named]# dig -x 192.168.0.1
[root@masterdns named]# dig -x 192.168.0.2
[root@masterdns named]# dig -x 192.168.0.3
CONFIGURATION OF SLAVE DNS
Step 1: CHECK IP & HOST ENTRIES
[root@client ~]# ifconfig
[root@client ~]# netconfig
[root@client ~]# service network restart
[root@client ~]# ping 192.168.0.0 -b
[root@client ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=slavedns.zoom.com
:wq!
[root@client ~]# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.2 slavedns.zoom.com slavedns
:wq!
[root@client ~]# hostname slavedns.zoom.com [root@client ~]# hostname
slavedns.zoom.com
* NOW LOG OFF & LOG IN *
Step 2 : CHECK & INSTALL THE PACKAGES
[root@slavedns ~]# rpm -qa | egrep -i "bind|caching"
Or
[root@slavedns ~]# yum list installed | egrep -i "bind|caching" [root@slavedns ~]# yum remove bind* caching*
[root@slavedns ~]# rm /etc/named*
[root@slavedns ~]# rm -rf /var/named*
Now Install the packages
[root@slavedns ~]# yum install bind* cach*
Step 3a) Edit MAIN CONFIGURATION FILE
[root@slavedns ~]# vi named.caching-nameserver.conf
listen-on port 53 { 127.0.0.1; 192.168.0.2; }; ## line no 15
allow-query { localhost; 192.168.0.0/24; }; ## line no 23
match-clients { localhost; 192.168.0.0/24; }; ## line no 32
:wq!
Step 3b) Edit Main Configuration File 2
[root@slavedns ~]# vi /etc/named.rfc1912.zones
zone "zoom.com" IN {
type slave;
file "slaves/fzoom";
masters { 192.168.0.1; }; ## Master DNS IP
};
zone "0.168.192.in-addr.arpa" IN {
type slave;
file "slaves/rzoom";
masters { 192.168.0.1; }; ## Master DNS IP
};
:wq!
[root@slavedns ~]# cd /var/named/chroot/var/named/slaves [root@slavedns ~]# ls
[root@slavedns ~]# service named restart
After starting the service automatically the zone files will be replicated at the slave side from master.
[root@slavedns ~]# ls
fzoom rzoom
[root@slavedns etc]# vi /etc/resolv.conf # Only provide Slaves DNS IP
nameserver 192.168.0.2
[root@slavedns ~]# service named restart
[root@slavedns ~]# dig slavedns.zoom.com
[root@slavedns ~]# dig masterdns.zoom.com
Note : Add an entry in forward zone file at master side and increase serial number then start service
Check the updates at slave dns Client Side Configuration
Provide the IP of DNS in following file
Note : /etc/resolv.conf supports maximun 3 DNS entries
[root@client ~]# vi /etc/resolv.conf
nameserver 192.168.0.1
nameserver 192.168.0.2
:wq!
[root@client]# dig masterdns.zoom.com
[root@client]# dig slavedns.zoom.com
[root@client]# dig nfs.zoom.com
[root@client]# dig sales1.zoom.com
[root@client]# dig -x 192.168.0.1
[root@client]# dig -x 192.168.0.2
[root@client]# dig -x 192.168.0.3
[root@client]# ping masterdns.zoom.com
[root@client]# ping slavedns.zoom.com
No comments:
Post a Comment