反向区域
区域名称:网络地址反写.in-addr.arpa.
172.16.100. --> 100.16.172.in-addr.arpa.
-
定义区域
zone "ZONE_NAME" IN { type {master|slave|forward}; file "网络地址.zone" };
-
定义区域解析库文件
注意:不需要MX,以PTR记录为主
反向区域示例
$TTL 86400
$ORIGIN 10.0.0.11.in-addr.arpa.
@ IN SOA ns1.abcd.com. admin.abcd.com. (
123456
1H
5M
7D
1D )
IN NS ns1.abcd.com.
IN NS ns2.abcd.com.
11 IN PTR ns1.abcd.com.
11 IN PTR www.abcd.com.
12 IN PTR mx1.abcd.com.
12 IN PTR www.abcd.com.
13 IN PTR mx2.abcd.com.
设置反向解析域
$ vim /etc/named.rfc1912.zones
zone "3.168.192.in-addr.arpa" IN {
type master;
file "192.168.3.zone";
};
新建区域数据库文件
$ touch /var/named/192.168.3.zone
$ chgrp named /var/named/192.168.3.zone #修改所属组
$ chmod o= /var/named/192.168.3.zone #去掉other的权限
$ vim /var/named/192.168.3.zone #编写数据库文件
$TTL 1D
@ IN SOA master admin ( 50 2H 10M 1W 1D )
NS master
master A 192.168.3.102
101 PTR www.hxg101.com.
102 PTR www.hxg102.org.
重新加载数据
$ rndc reload
客户端测试
$ dig -x 192.168.3.101
#或者
$ dig -t PTR 101.3.168.192.in-addr.arpa.
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7 <<>> -x 192.168.3.101
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33160
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;101.3.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
101.3.168.192.in-addr.arpa. 86400 IN PTR www.hxg101.com.
;; AUTHORITY SECTION:
3.168.192.in-addr.arpa. 86400 IN NS master.3.168.192.in-addr.arpa.
;; ADDITIONAL SECTION:
master.3.168.192.in-addr.arpa. 86400 IN A 192.168.3.102
;; Query time: 0 msec
;; SERVER: 192.168.3.102#53(192.168.3.102)
;; WHEN: 一 6月 08 07:14:16 CST 2020
;; MSG SIZE rcvd: 120
标签:abcd,named,zone,192.168,反向,DNS,解析,com,PTR
From: https://www.cnblogs.com/guangdelw/p/17300887.html