DNS reverse resolution and master-slave domain name server
1. DNS reverse resolution
1. Modify the main configuration file
Enter via vim /etc/named.conf command
2. Modify zone configuration file, add reverse zone configuration
Enter via vim /etc/named.rfc1912.zones command
3. Configure the reverse zone data file
cd /var/named/
cp -p named.localhost yang.com.zone
vim /var/named/lisi.com.zone
2. Build a master-slave domain name server
1. Use the previous configuration, modify the zone configuration file of the primary domain name server, modify the reverse zone configuration, and the forward direction is the same.
2. Modify the master configuration file of the slave domain name server
yum -y install bind
vim /etc/named.conf
3. Modify the zone configuration file of the slave domain name server, add the anti zone configuration, the same is true for the positive zone.
vim /etc/named.rfc1912.zones enter the editor
4. Both the master and slave restart the service, turn off the firewall, and check whether the area data file has been downloaded successfully
systemctl restart named 重启服务
systemctl stop firewalld #关闭防火墙
setenforce 0
ls -l /var/named/slaves/查看区域配数据文件
5. Add the slave DNS server address in the client's domain name resolution configuration file
echo "nameserver 192.168.178.15" >> /etc/resolv.conf 添加从DNS服务器地址
echo "nameserver 192.168.178.15" >> /etc/resolv.conf 添加主DNS服务器地址
6. Test
host 192.168.178.30
nslookup 192.168.178.30
7. Stop the service of the main server and simulate the failure of the main server
systemctl stop named 停止主服务器服务
host 192.168.178.30
nslookup 192.168.178.30