正向解析 安装所需组件 yum install bind-chroot.x86_64 -y 修改配置文件 vi /etc/named.conf 12 listen-on-v6 port 53 { any; }; 17 allow-query { any; }; vi /etc/named.rfc1912.zones 13 zone “xzh.com” IN{ 15 file “xzh.com.zone”; cd /var/named cp -a named.localhost xzh.com.zone vi named.localhost STTL 1DI @ IN SOA xzh. com. root. xzh. com. ( 0 ; serial 1D ; refresh 1H ; retry 1W; expire 3H); minimum NS ns.xzh.com. ns IN A 192.168.45.163 IN MX 10 mail.xzh.com. mail IN A 192.168.45.163 www IN A 192.168.45.163 bbs IN A 192.168.45.163 A 127.0.0.1 AAAA : :1 重启服务 systemctl restart named vi /etc/sysconfig/network-scripts/ifcfg-eno16777728 BOOTPROTO=static ONBOOT=yes IPADDR=192.168.45.163 GATEWAY=192.168.45.1 NETMASK=255.255.255.0 DNS=192.168.45.163 重启服务 systemctl restart network nslookup
反向解析 修改配置文件 vim /etc/named.rfc1912.zones zone “45.168.192.in-addr.arpa”IN{ type master; file”192.168.45.arpa”; allow-update{none;}; } cp -a named.loopback 192.168.45.arpa vi 192.168.45.arpa STTL 1DI @ IN SOA xzh. com. root. xzh. com. ( 0 ; serial 1D ; refresh 1H ; retry 1W; expire 3H); minimum NS ns.xzh.com. ns A 192.168.45.134 10 PTR ns.xzh.com 10 PTR mail.xzh.com 10 PTR www.xzh.com 10 PTR bbs.xzh.com A 127.0.0.1 AAAA : :1 PTR localhost 重启服务 systemctl restart named