主配置 (master)
# cat /etc/bind/named.conf.local
zone "xxx.com" {type master;file "/var/lib/bind/xxx.com.hosts";also-notify {172.17.151.242; // 从IP};};# cat /var/lib/bind/xxx.com.hosts
$ttl 3600
xxx.com. IN SOA xxx-dns1. xxx.xxx.com. (2024051103360060012096003600 )
xxx.com. IN NS xxx-dns1.
xxx.xxx.com. IN A 172.17.151.35
从配置 (slave)
# cat /etc/bind/named.conf.local
zone "xxx.com" {type slave;masters {172.17.151.241; // 主机IP};file "/var/lib/bind/xxx.com.hosts";};
两台服务器同时重起服务
# systemctl restart named.service
# systemctl status named.service
同步过程中发生报错
# journalctl -xeu named.servicenamed[9226]: zone mes.com/IN: transfer: could not set file modification time of '/var/lib/bind/xxx.com.hosts': permission denied
初步判断为文件权限问题
使用命令 调整与bind权限一致的owner即可解决
# chown bind:bind xxx.hosts