服务端
查看域名
[root@client yum.repos.d]# hostname
client
设置域名
[root@client yum.repos.d]# hostnamectl set-hostname dns1.openlab.edu
[root@client yum.repos.d]# cd
[root@client ~]# hostname
dns1.openlab.edu
安装bind包
[root@client ~]# yum install bind -y
进入主配置修改
[root@client ~]# vim /etc/named.conf
进入区域配置修改
[root@client ~]# vim /etc/named.rfc1912.zones
[root@client ~]# cd /var/named
[root@client named]# ll
拷贝named.locallhost
[root@client named]# cp -a named.localhost openlab.edu.zone
进行修改文件
[root@client named]# vim openlab.edu.zone
检查文件是否有误
[root@client named]# named-checkconf
[root@client named]# named-checkzone openlab.edu openlab.edu.zone
zone openlab.edu/IN: openlab.edu/MX 'mail.openlab.edu' has no address records (A or AAAA)
zone openlab.edu/IN: loaded serial 2024113001
OK
[root@client named]# setenforce 0
[root@client named]# systemctl stop firewalld
客户端
关掉防火墙等干扰
[root@server ~]# setenforce 0
[root@server ~]# systemctl stop firewalld
下载相关bind插件
[root@server ~]# yum install bind-utils -y
测试
反向:
对于服务器
[root@client named]# vim /etc/named.rfc1912.zones
[root@client named]# cd /var/named
[root@client named]# ls
data named.ca named.localhost openlab.edu.zone
dynamic named.empty named.loopback slaves
[root@client named]# cp -a named.loopback 192.168.131.zone
[root@client named]# vim 192.168.131.zone
[root@client named]# systemctl restart named
客户端测试与正向测试一样