CentOS 7搭建DNS服务(2)

配置选项详解:

CentOS 7搭建DNS服务

[root@localhost named]# vim 192.168.10.arpa #编写反向区域配置文件 $TTL 1D @ IN SOA @ rname.invalid. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS ns1.benet.com. 1 IN PTR ns1.benet.com. 10 IN PTR

编写完成后

[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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/04cdeda06614fec9d16fe17347723456.html