-----------------------------------------------------------------------------------------------------------------------------------------
主服务器上IP为192.168.10.105
1.正向解析:
a.安装包
yum -y install bind
b.编辑主配置文件
[root@ns1 ~]# vim /etc/named.conf
options {
listen-on port 53 { 127.0.0.1;192.168.10.105; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
在最后一行添加
zone "jqm.com" IN {
type master;
file "jqm.com.zone";
};
c.检查主配置文件语法的
named-checkconf
d.编辑区域配置文件
[root@ns1 ~]# vim /var/named/jqm.com.zone
$TTL 1D
@ IN SOA @ admin.jqm.com. (
2016071001 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.jqm.com.
IN MX 5 mail.jqm.com.
mail IN A 192.168.10.102
ns1 IN A 192.168.10.105
www IN A 192.168.10.103
bbs IN CNAME www.jqm.com.
检查区域数据文件语法的、指定区域和指定文件
named-checkzone "jqm.com" /var/named/jqm.com.zone
[root@ns1 ~]# service named restart
测试解析:
[root@ns1 ~]# dig @192.168.10.105 www.jqm.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @192.168.10.102 www.jqm.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21258
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;www.jqm.com. IN A
;; ANSWER SECTION:
www.jqm.com. 86400 IN A 192.168.10.103
;; AUTHORITY SECTION:
jqm.com. 86400 IN NS ns1.jqm.com.
;; ADDITIONAL SECTION:
ns1.jqm.com. 86400 IN A 192.168.10.105
;; Query time: 3 msec
;; SERVER: 192.168.10.102#53(192.168.10.102)
;; WHEN: Sun Aug 28 10:34:19 2016
;; MSG SIZE rcvd: 79
2.反向解析:
a.修改主配置文件
[root@ns1 ~]# vim /etc/named.conf
在最后一行添加如下:
zone "10.168.192.in-addr.arpa" IN {
type master;
file "10.168.192.zone";
};
b.编辑区域配置文件
vim /var/named/10.168.192.zone
添加如下:
$TTL 1D
@ IN SOA @ admin.jqm.com. (
2016071001 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.jqm.com.
102 IN PTR mail.jqm.com.
105 IN PTR ns1.jqm.com.
103 IN PTR www.jqm.com.
c.检测:
[root@localhost ~]# named-checkconf
d.重启服务
[root@localhost ~]# service named restart
停止 named: [确定]
启动 named:
e.测试:
[root@localhost ~]# dig @192.168.10.105 -x 192.168.10.105
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> @192.168.10.105 -x 192.168.10.105
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38837
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;105.10.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
105.10.168.192.in-addr.arpa. 86400 IN PTR ns1.jqm.com.
;; AUTHORITY SECTION:
10.168.192.in-addr.arpa. 86400 IN NS ns1.jqm.com.
;; ADDITIONAL SECTION:
ns1.jqm.com. 86400 IN A 192.168.10.105
;; Query time: 1 msec
;; SERVER: 192.168.10.105#53(192.168.10.105)
;; WHEN: Mon Aug 29 11:02:53 2016
;; MSG SIZE rcvd: 100
测试成功
编辑回复