配置选项详解:
编写完成后
[root@localhost named]# named-checkconf -z /etc/named.conf #检查对应的数据库文件 zone benet.com/IN: loaded serial 0 zone 10.168.192.in-addr.arpa/IN: loaded serial 0 zone localhost.localdomain/IN: loaded serial 0 zone localhost/IN: loaded serial 0 zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0 zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0 zone 0.in-addr.arpa/IN: loaded serial 0 [root@localhost named]# named-checkconf /etc/named.conf #检查主区域配置文件 [root@localhost named]# named-checkzone benet.com benet.com.zone #检查区域配置文件 zone benet.com/IN: loaded serial 0 OK [root@localhost named]# systemctl start named #启动DNS服务 [root@localhost named]# nslookup > Server: 127.0.0.1 Address: 127.0.0.1#53 Name: Address: 192.168.10.10 > ns1.benet.com Server: 127.0.0.1 Address: 127.0.0.1#53 Name: ns1.benet.com Address: 192.168.10.1主域名服务器经过测试没问题!
搭建从域名服务器
[root@localhost ~]# yum -y install bind* #安装bind服务 [root@localhost ~]# vim /etc/named.conf #编写主配置文件 ……………… #省略部分内容 12 options { 13 listen-on port 53 { any; }; 14 listen-on-v6 port 53 { ::1; }; 15 directory "/var/named"; 16 dump-file "/var/named/data/cache_dump.db"; 17 statistics-file "/var/named/data/named_stats.txt"; 18 memstatistics-file "/var/named/data/named_mem_stats.txt"; 19 allow-query { any; }; 20 forwarders { 192.168.10.1; }; #转发器,本机解析不了转发到192.168.10.1 ……………… #省略部分内容 57 zone "benet.com" in { 58 type slave; #区域类型为辅助区域 59 masters { 192.168.10.1; }; #主服务器为192.168.10.1 60 file "slaves/benet.com.zone"; #复制下来的文件保存到/var/named/slaves/目录下 61 allow-transfer { 192.168.10.1; }; #允许从服务器上下载正向区域配置文件 62 }; 63 zone "10.168.192.in-addr.arpa" { 64 type slave; 65 masters { 192.168.10.1; }; 66 file "slaves/192.168.10.arpa"; 67 }; [root@localhost slaves]# named-checkconf -z /etc/named.conf #检查named服务数据库配置文件 zone localhost.localdomain/IN: loaded serial 0 zone localhost/IN: loaded serial 0 zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0 zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0 zone 0.in-addr.arpa/IN: loaded serial 0 [root@localhost /]# systemctl start named [root@localhost /]# nslookup > Server: 127.0.0.1 Address: 127.0.0.1#53 Name: Address: 192.168.10.10 > ns1.benet.com Server: 127.0.0.1 Address: 127.0.0.1#53 Name: ns1.benet.com Address: 192.168.10.1 [root@localhost /]# ls /var/named/slaves/ benet.com.zone #从主域名服务器复制的正向区域文件从域名服务器验证完成!
在Windows客户机上如果出现错误可使用命令“ipconfig /flushdns”刷新一下本地的DNS缓存!
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx