1、 ready
Example: two 192.168.11.10 (master), 192.168.11.11 (slave), domain name www.test1.com
# Both master and slave DNS servers need to install bind and bind-chroot、bind-utils
yum -y install bind bind-utils bind-chroot
# If the firewall is enabled, configure the firewall and add services(Ignore if the firewall is disabled)
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
2、 Primary DNS server (192.168.11.10) configuration
# Edit configuration file
vim /etc/named.conf
# Find two lines
listen-on port 53{127.0.0.1;};
allow-query { localhost;};
# change into
listen-on port 53{ any;};
allow-query { any;};
3、 Configure forward analysis
# Edit file/etc/named.rfc1912.zones, add the domains that need to be resolved at the end
zone "test1.com" IN {
type master;
file "data/test1.com.zone";};
# Create test1.com.zone resolution domain
vim /var/named/data/test1.com.zone
$TTL 3H
@ IN SOA test1.com.root(20180928; serial
1D ; refresh
1H ; retry
1W ; expire
3H ); minimum
IN NS @
IN A 192.168.11.10
www IN A 192.168.11.10
ftp IN A 192.168.11.10
# edit/etc/resolv.conf, add
search localdomain
nameserver 192.168.11.10
4、 Restart DNS server
# Restart named
systemctl restart named
# Check status
systemctl status named
5、 Check if the analysis is successful
# ping command verification
ping -c 4 www.test1.com
# The output is as follows and the analysis is successful
PING www.test1.com(192.168.11.10)56(84) bytes of data.64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=3 ttl=64 time=0.066 ms
64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=4 ttl=64 time=0.057 ms
--- www.test1.com ping statistics ---4 packets transmitted,4 received,0% packet loss, time 3000ms
rtt min/avg/max/mdev =0.033/0.053/0.066/0.014 ms
# nslookup command verification
nslookup
> www.test1.com
# The output is as follows and the analysis is successful
Server:192.168.11.10
Address:192.168.11.10#53
Name: www.test1.com
Address:192.168.11.10
6、 Configure reverse analysis
# Edit file/etc/named.rfc1912.zones, add at the end
vim etc/named.rfc1912.zones
zone "11.168.192.in-addr.arpa" IN {
type master;
file "data/11.168.192.zone";};
# Created 11.168.192.zone resolution domain
vim /var/named/data/11.168.192.zone
$TTL 3H
@ IN SOA web3.com.root(20180928; serial
1D ; refresh
1H ; retry
1W ; expire
3H ); minimum
@ IN NS www.test1.com.10 IN PTR www.test1.com.10 IN PTR ftp.test1.com.
7、 Restart DNS server
# Restart named
systemctl restart named
# Check status
systemctl status named
8、 Check if the analysis is successful
# ping command verification
ping -c 4192.168.11.10
# The output is as follows and the analysis is successful
PING 192.168.11.10(192.168.11.10)56(84) bytes of data.64 bytes from192.168.11.10: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from192.168.11.10: icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from192.168.11.10: icmp_seq=3 ttl=64 time=0.081 ms
64 bytes from192.168.11.10: icmp_seq=4 ttl=64 time=0.060 ms
---192.168.11.10 ping statistics ---4 packets transmitted,4 received,0% packet loss, time 3000ms
rtt min/avg/max/mdev =0.058/0.065/0.081/0.009 ms
# nslookup command verification
nslookup 192.168.11.10
# The output is as follows and the analysis is successful
Server:192.168.11.10
Address:192.168.11.10#5310.11.168.192.in-addr.arpa name = ftp.test1.com.10.11.168.192.in-addr.arpa name = www.test1.com.
9、 Configure the slave DNS server (192.168.11.11)
# Modify the primary DNS server first(192.168.11.10)Configuration/etc/named.rfc1912.zones
vim /etc/named.rfc1912.zones
zone "test1.com" IN {
type master;
file "data/test1.com.zone";
allow-transfer {192.168.11.11;};
notify yes;
also-notify {192.168.11.11;};};
zone "11.168.192.in-addr.arpa" IN {
type master;
file "data/11.168.192.zone";
allow-transfer {192.168.11.11;};
notify yes;
also-notify {192.168.11.11;};};
10、 Configure forward resolution from DNS server (192.168.11.11)
# Edit named.conf file
vim /etc/named.conf
#Find two lines
listen-on port 53{127.0.0.1;};
allow-query { localhost;};
#change into
listen-on port 53{ any;};
allow-query { any;};
# Edit file/etc/named.rfc1912.zones, add the domains that need to be resolved at the end
vim /etc/named.rfc1912.zones
zone "test1.com" IN {
type slave;
file "data/test1.com.zone";};
masters {192.168.11.10;};
# Create test1.com.zonek empty file
touch /var/named/data/test1.com.zone
# Set owner
chown named:named test1.com.zone
# edit/etc/resolv.conf, add
vim /etc/resolv.conf
search localdomain
nameserver 192.168.11.11
11、 Restart DNS server
# Restart named
systemctl restart named
# Check status
systemctl status named
12、 Check whether the analysis is successful
# ping command verification
ping -c 4 www.test1.com
# The output is as follows and the analysis is successful
PING www.test1.com(192.168.11.10)56(84) bytes of data.64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=3 ttl=64 time=0.066 ms
64 bytes from ftp.test1.com(192.168.11.10): icmp_seq=4 ttl=64 time=0.057 ms
--- www.test1.com ping statistics ---4 packets transmitted,4 received,0% packet loss, time 3000ms
rtt min/avg/max/mdev =0.033/0.053/0.066/0.014 ms
# nslookup command verification
nslookup
> www.test1.com
# The output is as follows and the analysis is successful
Server:192.168.11.11
Address:192.168.11.11#53
Name: www.test1.com
Address:192.168.11.10
13、 Configure reverse resolution from DNS server (192.168.11.11)
# In file/etc/named.rfc1912.add in zones
vim etc/named.rfc1912.zones
zone "11.168.192.in-addr.arpa" IN {
type master;
file "data/11.168.192.zone";
masters {192.168.11.10;};};
# Create empty file 11.168.192.zone
touch /var/named/data/11.168.192.zone
# Set owner
chown named:named 11.168.192.zone
14、 Restart DNS server
# Restart named
systemctl restart named
# Check status
systemctl status named
15、 Check whether the files /var/named/data/test1.com.zone and /var/named/data/11.168.192.zone have binary data
cat /var/named/data/test1.com.zone
cat /var/named/data/11.168.192.zone
16、 Check if the analysis is successful
# ping command verification
ping -c 4192.168.11.11
# The output is as follows and the analysis is successful
PING 192.168.11.11(192.168.11.11)56(84) bytes of data.64 bytes from192.168.11.11: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from192.168.11.11: icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from192.168.11.11: icmp_seq=3 ttl=64 time=0.081 ms
64 bytes from192.168.11.11: icmp_seq=4 ttl=64 time=0.060 ms
---192.168.11.11 ping statistics ---4 packets transmitted,4 received,0% packet loss, time 3000ms
rtt min/avg/max/mdev =0.058/0.065/0.081/0.009 ms
# nslookup command verification
nslookup 192.168.11.11
# The output is as follows and the analysis is successful
Server:192.168.11.11
Address:192.168.11.11#5310.11.168.192.in-addr.arpa name = ftp.test1.com.10.11.168.192.in-addr.arpa name = www.test1.com.
to sum up
The above is the tutorial for setting up a master-slave DNS server for Centos7 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!
Recommended Posts