操作篇:
DNS服务器主从同步:
首先同步时间:
主从都要关闭
在主域名服务器上:(192.168.80.181)
yum install ntp -y
vi /etc/ntp.conf
加入以下三行在指定的位置
restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0
fudge 127.127.1.0 stratum 8
启动服务
service ntpd start
systemctl enable ntpd
在从域名服务器上:192.168.80.182
yum install ntp -y
ntpdate 192.168.80.181 //用从的去同步主服务器的时间
主:
从:
搭建主从同步:
在主域名服务器上:
vi /etc/named.conf
修改以下内容:
listen-on port 53 { any; };
allow-query { any; };
vi /etc/named.rfc1912.zones
在最下面添加以下内容
zone "hello.com" IN {
type master;
file "hello.com.zone";
allow-update { 192.168.80.101; };
also-notify { 192.168.80.101; };
};zone "80.168.192.in-addr.arpa" IN {
type master;
file "hello.com.local";
allow-update { 192.168.80.101; };
also-notify { 192.168.80.101; };
};cd /var/named/
cp -p named.localhost hello.com.zone
vi hello.com.zone
cp -p hello.com.zone hello.com.local
vi hello.com.local
systemctl start named //启动dns服务
.
在从域名服务器上:
yum install bind -y
vi /etc/named.conf
listen-on port 53 { any; };
allow-query { any; };
vi /etc/named.rfc1912.zones
zone "hello.com" IN {
type slave;
masters { 192.168.80.181; };
file "slaves/hello.com.zone";
};
zone "80.168.192.in-addr.arpa" IN {
type slave;
masters { 192.168.80.181; };
file "slaves/hello.com.local";
};然后启动服务
这里出现了乱码
解决方法:
vi /etc/named.conf
masterfile-format text ;
转载于:https://blog.51cto.com/14188767/2348998