配置dns主从服务。要求从服务器能够定时从主服务器同步数据。
目的:
配置dns主从服务。
要求从服务器能够定时从主服务器同步数据。
- 主服务器(Master):IP
192.168.168.133 - 从服务器(Slave):IP
192.168.1.135
1、安装dns服务
[root@localhost ~]# mount /dev/sr0 /mnt
[root@localhost ~]# yum install bind
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalled
2、主服务端配置
(1)通过vim /etc/named.conf 命令进入,编辑主配置文件设置监听IP

(2)通过vim /etc/named.rfc1912.zones ,打开区域配置文件,添加如下内容,重点为:允许从服务器的同步请求。

(3)正向解析
通过vim openlab.com.zone进入配置

(4)反向解析
通过vim /var/named/192.168.168.arpa进入配置

(5)主服务端重启服务:
[root@localhost named]# systemctl restart named
3、从服务器配置
(1)使用vim /etc/named.conf 进行配置

(2)重启服务
[root@localhost root123]# systemctl start named4、测试
[root@localhost slaves]# nslookup www.openlab.com
Server: 192.168.168.135
Address: 192.168.168.135#53Name: www.openlab.com
Address: 192.168.168.133[root@localhost slaves]# nslookup 192.168.168.133
133.168.168.192.in-addr.arpa name = bbs.openlab.com.
133.168.168.192.in-addr.arpa name = www.openlab.com.
133.168.168.192.in-addr.arpa name = ns.openlab.com.
133.168.168.192.in-addr.arpa name = ftp.openlab.com.使用 dig @192.168.168.133 www.openlab.com

