修改主机名
[root@localhost ~]# hostnamectl set-hostname mail
[root@localhost ~]# bash
[root@localhost ~]# hostnamectl set-hostname dns
[root@localhost ~]# bash
以下操作均在两台虚拟机进行
[root@mail ~]# systemctl stop firewalld
[root@mail ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@mail ~]# setenforce 0
安装并且安装测试工具
[root@mail ~]# yum -y install bind-utils net-tools telnet
[root@mail ~]# yum -y install bind-chroot bind-utils
启动服务查看状态
[root@mail ~]# systemctl start named
[root@mail ~]# systemctl status named
● named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2021-01-24 04:55:57 CST; 19s ago
Process: 3056 ExecStart=/usr/sbin/named -u named $OPTIONS (code=exited, status=0/SUCCESS)
Process: 3053 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z /etc/named.conf; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
Main PID: 3059 (named)
CGroup: /system.slice/named.service
└─3059 /usr/sbin/named -u named
Jan 24 04:55:57 mail named[3059]: all zones loaded
Jan 24 04:55:57 mail named[3059]: running
Jan 24 04:55:57 mail systemd[1]: Started Berkeley Internet ...
Jan 24 04:55:57 mail named[3059]: error (network unreachabl...
Jan 24 04:55:57 mail named[3059]: error (network unreachabl...
Jan 24 04:55:57 mail named[3059]: error (network unreachabl...
Jan 24 04:55:57 mail named[3059]: error (network unreachabl...
Jan 24 04:55:57 mail named[3059]: validating @0x7f2480600...
Jan 24 04:55:57 mail named[3059]: validating @0x7f2480600...
Jan 24 04:55:58 mail named[3059]: error (broken trust chain...
Hint: Some lines were ellipsized, use -l to show in full.
查看端口(端口为53)
[root@mail ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 3059/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1457/sshd
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 3059/named
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1773/master
tcp6 0 0 ::1:53 :::* LISTEN 3059/named
tcp6 0 0 :::22 :::* LISTEN 1457/sshd
tcp6 0 0 ::1:953 :::* LISTEN 3059/named
tcp6 0 0 ::1:25 :::* LISTEN 1773/master
修改named.conf