CentOS7 DNS master-slave synchronization
192.168.80.102 main
192.168.80.103 from
Both master and slave must be closed
systemctl stop firewalld
setenforce 0
On the primary DNS: (192.168.80.102)
First sync time:
yum install ntp -y
yum install bind -y
vi /etc/ntp.conf
Add the following three lines at the specified locations
restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0
fudge 127.127.1.0 stratum 8
-
start the service
service ntpd start
start automatically when the system
systemctl enable ntpd
-
On the slave domain name server: 192.168.80.103
yum install ntp -y
ntpdate 192.168.80.181 master server time with slave
Go to main service 80.102vi /etc/named.conf
#Forward and reverse parsing file storage directory, preceded by a backslash representative comment
Modify the following:
listen-on port 53 { any; };
allow-query { any; };
vi /etc/named.rfc1912.zones Add the following at the bottom zone "hello.com" IN { type master; file "hello.com.zone"; allow-update { 192.168.80.103; }; also-notify { 192.168.80.103; };};zone "80.168.192.in-addr.arpa" IN { type master; file "hello.com.local"; allow-update { 192.168.80.103; }; also-notify { 192.168.80.103; };};
cd /var/named/
cp -p named.localhost hello.com.zone
vi hello.com.zone
cd /var/named/cp -p named.localhost hello.com.zonevi hello.com.zone$TTL 1D@ IN SOA hello.com. 3040401509.qq.com ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS dns.hello.com.dns IN A 192.168.80.102www IN A 192.168.80.103ftp IN A 192.168.80.104
Region Resolution Library:
resource record rr
SOA: Initial authorization record, a zone file can have only one.
NS: Authorized zone (which DNS server is authorized).
MX: Mail exchanger, MX records have priority attributes 0-99, the lower the number the higher.
A: Convert FQDN to IP address.
PTR:IP to FQDN conversion.
AAAA:FQDN -- IPV6。
CNAME: Official name.
cp -p hello.com.zone hello.com.localvi hello.com.local$TTL 1D@ IN SOA hello.com. 3040401509.qq.com ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS dns.hello.com.102 IN PTR dns.hello.com.103 IN PTR www.hello.com.
systemctl start named //start dns service
netstat -anpt | grep named
80.103: yum install bind -yvi /etc/named.conf liste-on port 53 { any; };allow-query { any; };vi /etc/named.rfc1912.zones#Add zone "hello.com" IN { type slave; masters { 192.168.80.102; }; file "slaves/hello.com.zone";};zone "80.168.192.in-addr.arpa" IN { type slave; masters { 192.168.80.102; }; file "slaves/hello.com.local";};
systemctl start named #Start server
cd /var/named/slaves/cat hello.com.zone
There's some garbled code here.
Solution:
vi /etc/named.conf
masterfile-format text ;
systemctl restart named restart service
cat hello.com.zone