Configure DNS Server
DNS Domain Name System ( Service Locator )
Mapping Computer To IP
-------------------------------
How DNS Works ?
--------------------------------
Package bind ( Bekely Internet Naming Domain )
Configuration Files /etc/named.conf dns configuration
Data Files /var dns zone files records
service systemctl enable | start | status named.service
Firewall Configuration to allow traffic
--------------------------------
DNS Server Configuration
# yum install bind*
# vim /etc/named.conf Edit the folowing Lines
listen-on port 53 { 127.0.0.1; any; }; allow traffic from
any NIC interface for DNS Server
allow-query { localhost; any; }; allow queries from
any client (any or > 10.0.0.0/8; 192.168.1.0/24)
forwarders { 8.8.8.8; };
zone "abc.com" IN { add zone informations
type master;
file "abc.com.db"; >>>> file "/var/named/abc.com.db"
};
# named-checkconf
#touch /var/named/abc.com.db
# cp /var/named/named.empty /var/named/abc.com.db copy sample file
# chgrp named /var/named/abc.com.db change group
ownership to named
# vim /var/named/abc.com.db
$TTL 3H
@ IN SOA abc.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS DNS1.abc.com.
A 127.0.0.1
AAAA ::1
DNS1 IN A 10.0.0.1
Web1 IN A 10.0.0.2
www IN CNAME web1.abc.com.
mail IN A 10.0.0.3
Enable and Start DNS Service :-
# systemctl enable named.service
# systemctl start named.service
# systemctl status named.service
allow firewall traffic :-
# firewall-cmd --add-service=dns --permanent
# firewall-cmd --reload
# firewall-cmd --list-services
-----------------------------------------------------------------------------
Configure DNS Client
# vim /etc/resolv.conf
nameserver 10.0.0.1 >>>>>DNS server IP
# nslookup www.abc.com
# nslookup mail.abc.com
# nslookup DNS1.abc.com
------------------------------------------------------------------------------
configure DNS slave
on Slave Vm
# yum install bind*
edit this lines only in /etc/named.conf on the slave
listen-on port 53 { 127.0.0.1; 192.168.202.102;}; >>>>>192.168.202.102 (slave
ip)
allow-query { any;};
on Master Vm
In order to let the master notify the slave when a zone is updated and to allow the
zone transfers,
we need to add the following lines to the master’s /etc/named.conf in the
options{}-section:
notify yes;
also-notify { 192.168.202.102; }; >>>> modify the ip
allow-transfer { 127.0.0.1; 192.168.202.102; };
#sudo named-checkconf /etc/named.conf
#sudo systemctl reload named
#sudo systemctl start named
By looking at /var/named/data/named.run on the slave, you can see that the data was
transferred from the master.
# sudo tail /var/named/data/named.run
to test the configuration (on slave vm)
nslookup mail.gs.com 192.168.202.101 >>>> 192..... master ip
-----------------------------------------------------------------------------------
-------