1. 程式人生 > >BIND <反向解析>

BIND <反向解析>

BIND DNS 反向解析

1.修改配置文件,新增區域,域名中主機位可省略再加特定後綴.in-addr.arpa(例如172.16.1.0/24網段的反向解析域應為1.16.172.in-addr.arpa

[root@el7 ]# vim /etc/named.rfc1912.zones

zone "1.16.172.in-addr.arpa" {

type master;

file "172.16.1.in-addr.arpa "

};

[root@el7]# named-checkconf

2.創建區域解析庫

[root@el7]# vim /var/named/172.16.1.in-addr.arpa

$TTL 1D

@ IN SOA ns1.huying.com. admin.huying.com. (

201802

1H

30M

3H

1D

)

IN NS ns1.huying.com.

$ORIGIN 1.16.172.in-addr.arpa.

1 IN PTR ns1.huying.com.

1 IN PTR www.huying.com.

技術分享圖片

[root@el7 named]# named-checkzone 1.16.172.in-addr.arpa 172.16.1.in-addr.arpa

zone 1.16.172.in-addr.arpa/IN: loaded serial 201801

OK

3.重載服務、測試

[root@el7 named]# rndc reload

server reload successful

[root@el7 named]# dig -x 172.16.1.1

; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7_4.2 <<>> -x 172.16.1.1

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23532

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 4096

;; QUESTION SECTION:

;1.1.16.172.in-addr.arpa. IN PTR

;; ANSWER SECTION:

1.1.16.172.in-addr.arpa. 86400 IN PTR www.huying.com.

1.1.16.172.in-addr.arpa. 86400 IN PTR ns1.huying.com.

;; AUTHORITY SECTION:

1.16.172.in-addr.arpa. 86400 IN NS ns1.huying.com.

;; ADDITIONAL SECTION:

ns1.huying.com. 86400 IN A 192.168.1.1

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Thu May 10 15:09:42 CST 2018

;; MSG SIZE rcvd: 128


BIND <反向解析>