DNS Server linuxLinux serverNETWORK ADMINISTRATIONS

How to Install and Configure DNS Client in Linux VM from scratch on ESXI

In this tutorial, we will explain how to install and configure a DNS Client.
One of the primary purposes of a Slave zone is to serve as a backup. When the master zone is down, it can still answer requests for the zone from its copy.
DNS stands for Domain Name System, or Domain Name Server.
DNS resolves an IP address to a hostname or vice versa.
DNS is basically a large database which resides on various computers that contains the names and IP addresses of various hosts/domains. Other than ip-address DNS also associates various information with the domain names.
=====================================================
192.168.0.104 Setup DNS Server https://www.tecmint.com/setup-master-slave-dns-server-in-centos/

#connect to yum server

yum install bind -y
yum install bind-utils -y
service named restart
netstat -anp | grep -w 53
vi /etc/named.conf
listen-on port 53 { 127.0.0.1; 192.168.0.104; }; #add ip addr.
allow-query { local host; 192.168.0.0/24; }; #add subnet
allow-transfer { localhost; 192.168.0.105; }; # Here we need to our Slave DNS server IP.
add
## Define our forward & reverse Zone file here for ddns.net
zone”ddns.net” IN {
type master;
file “dns.fwd.zone”;
allow-update { none; };
};
zone”0.168.192.in-addr.arpa” IN {
type master;
file “dns.rev.zone”;
allow-update { none; };
};

cd /var/named
cp -p named.localhost dns.fwd.zone
cp -p named.localhost dns.rev.zone
vi dns.fwd.zone
; Name server’s
@ IN NS dnsserver.ddns.net.
@ IN NS dnsslave.ddns.net.

; Hosts in this Domain
@ IN A 192.168.0.104
@ IN A 192.168.0.105
dnsclient IN A 192.168.0.99
yumserver IN A 192.168.0.103
nfsserver IN A 192.168.0.101

vi dns.rev.zone
; Name server’s
@ IN NS dnsserver.ddns.net.
@ IN NS dnsslave.ddns.net.
@ IN PTR ddns.net.
; Name server hostname to IP resolve.
DNSServer IN A 192.168.0.104
DNSSlave IN A 192.168.0.105
;Hosts in Domain
99 IN PTR dnsclient.ddns.net.
104 IN PTR dnsserver.ddns.net.
105 IN PTR dnsslave.ddns.net.
101 IN PTR nfsserver.ddns.net.
103 IN PTR yumserver.ddns.net.

# ls -l if you have root:root you have to change group to named
chgrp named /var/named/dns.fwd.zone
chgrp named /var/named/dns.rev.zone
ls -l /var/named

#check for the errors in zone files, before starting the DNS service
named-checkconf /etc/named.conf
named-checkzone dnsserver.ddns.net /var/named/dns.fwd.zone
named-checkzone dnsslave.ddns.net /var/named/dns.rev.zone

iptables -I INPUT -p udp –dport 53 -m state –state NEW -j ACCEPT
iptables -L INPUT
service iptables save
service iptables restart
chkconfig iptables on

service named start
chkconfig named on

#test the configured Master DNS zone files
nslookup ddns.net
nslookup dnsserver.ddns.net
nslookup dnsslave.ddns.net

192.168.0.105 Setup Slave DNS Server

#connect to yum server

yum install bind -y
yum install bind-utils -y
vi /etc/named.conf
listen-on port 53 { 127.0.0.1; 192.168.0.105; }; # Our Slave DNS server IP
allow-query { localhost; 192.168.0.0/24; };
recursion no;
## Define our slave forward and reverse zone, Zone files are replicated from master.
zone”ddns.net” IN {
type slave;
file “slaves/dns.fwd.zone”;
masters { 192.168.0.104; };
};
zone”0.168.192.in-addr.arpa” IN {
type slave;
file “slaves/dns.rev.zone”;
masters { 192.168.0.104; };
};

service named start
chkconfig named on
ls -l /var/named/slaves
#we don’t have to define the zone information individually,
#as our “allow-transfer” will replicate the zone information from master server
cat /var/named/slaves/dns.fwd.zone
cat /var/named/slaves/dns.rev.zone

iptables -I INPUT -p udp –dport 53 -m state –state NEW -j ACCEPT
service iptables save
service iptables restart
chkconfig iptables on

192.168.0.99 Configure Client Machine

setup Network Configuration
Primary DNS 192.168.0.104
Secondary DNS 192.168.0.105

vi /etc/resolv.conf
search ddns.net
dnsserver 192.168.0.104
dnsslave 192.168.0.105

ping dnsserver.ddns.net
ping dnsslave.ddns.net
ping 192.168.0.104
ping 192.168.0.105

#######
Finally, setup completed, here we have configured
both Primary (Master) and Slave (Seconday) DNS server successfully,
hope everyone have setup-ed without any issue,
feel free to drop a comment if you face any issue while setup.
=====================================================

source by Red Hat Man

linux dns server

Leave a Reply

Your email address will not be published. Required fields are marked *