Answers:
如果您使用Unix或Linux,则可以通过在命令提示符下键入以下命令来执行此操作:
dig -x xx.yy.zz.aa
您将获得具有aa.zz.yy.xx.in-addr.arpa权限的答案,并且服务器将解析到该地址。
在Windows中,您可以执行此操作nslookup xx.yy.zz.aa
。
您也可以在www.intodns.com上进行联机检查并输入您的域...检查反向区域查找的结果将出错。
xx.yy.zz.aa =您要解析的IP地址
更新:
使用dig,nslookup或主机时,经常在控件之外使用DNS服务器(例如Google(8.8.8.8))很有用,这样您就可以从第三方获得确认。– Zoredache
Zoredache 很好。以下是用于测试/解析到外部/外部DNS服务器的命令:
Dig(在8.8.8.8的Google DNS服务器上测试反向DNS):
dig -x zz.yy.xx.aa @8.8.8.8
主机和Nslookup(在8.8.8.8的Google DNS服务器上测试反向dns)
nslookup zz.yy.xx.aa 8.8.8.8
host zz.yy.xx.aa 8.8.8.8
我知道这已被标记为已回答,但我想提供更全面的答案。对于我的示例,我将使用:
首先要注意的dig
是一个多平台命令,您可以在BIND下方列出的ISC BIND网站上将其用于Windows ,然后选择Windows平台(32或64位)。它还有许多其他工具,包括自己的nslookup二进制文件。我不使用该nslookup.exe版本,而是使用Windows附带的默认版本(C:\ Windows \ System32 \ nslookup.exe)。但是,如果要使用dig
,则可能需要编辑本地PATH环境变量,或将dig
工具移至C:\ Windows \ System32文件夹。
命令1)dig PTR 206.3.217.172.in-addr.arpa
-传统上,这是用户执行反向DNS查找的方式。他们将手动转置IP地址:172.217.3.206
至206.3.217.172
(注意四个八位位组中每个八位位组的顺序)并添加in-addr.arpa
到字符串的末尾。这是输出:
; <<>> DiG 9.9.5 <<>> PTR 206.3.217.172.in-addr.arpa
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39790
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;206.3.217.172.in-addr.arpa. IN PTR
;; ANSWER SECTION:
206.3.217.172.in-addr.arpa. 84300 IN PTR sea15s12-in-f206.1e100.net.
206.3.217.172.in-addr.arpa. 84300 IN PTR sea15s12-in-f14.1e100.net.
206.3.217.172.in-addr.arpa. 84300 IN PTR sea15s12-in-f14.1e100.net.
206.3.217.172.in-addr.arpa. 84300 IN PTR sea15s12-in-f206.1e100.net.
;; Query time: 23 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun Mar 26 04:20:28 Pacific Daylight Time 2017
;; MSG SIZE rcvd: 153
命令2)dig -x 172.217.3.206
-此命令的版本要简单得多,如中所述dig -h
,该-x
标志是“反向查找的快捷方式”。输出与上面命令中显示的输出相同。
命令3)dig -x 151.101.1.69
-此示例使用serverfault.com示例显示未找到PTR记录时的外观。如您所见,答案没有列出PTR,而只能找到以下内容的SOA记录151.in-addr.arpa
:
; <<>> DiG 9.9.5 <<>> -x 151.101.1.69
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 21854
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;69.1.101.151.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
151.in-addr.arpa. 1786 IN SOA pri.authdns.ripe.net. dns.ripe.net. 1490512027 3600 600 864000 3600
;; Query time: 23 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun Mar 26 04:30:38 Pacific Daylight Time 2017
;; MSG SIZE rcvd: 114
命令4)nslookup 172.217.3.174
-这是用户l0c0b0x在该线程的主要答案中建议的命令。虽然确实有结果,但尚不清楚这是PTR记录还是其他某种类型的记录。我认为如果给定IP,默认情况下它确实会返回PTR,但是我仍然想确定。如果有多个PTR,它也会忽略其他记录:
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Name: sea15s11-in-f14.1e100.net
Address: 172.217.3.174
命令5)nslookup -debug 172.217.3.174
-改用此命令查看完整列表,包括记录类型和结果完整列表。该-debug
标志持续存在,要关闭它,您必须使用-nodebug
:
------------
Got answer:
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 0, additional = 0
QUESTIONS:
8.8.8.8.in-addr.arpa, type = PTR, class = IN
ANSWERS:
-> 8.8.8.8.in-addr.arpa
name = google-public-dns-a.google.com
ttl = 86141 (23 hours 55 mins 41 secs)
------------
Server: google-public-dns-a.google.com
Address: 8.8.8.8
------------
Got answer:
HEADER:
opcode = QUERY, id = 2, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 4, authority records = 0, additional = 0
QUESTIONS:
174.3.217.172.in-addr.arpa, type = PTR, class = IN
ANSWERS:
-> 174.3.217.172.in-addr.arpa
name = sea15s11-in-f14.1e100.net
ttl = 83026 (23 hours 3 mins 46 secs)
-> 174.3.217.172.in-addr.arpa
name = sea15s11-in-f174.1e100.net
ttl = 83026 (23 hours 3 mins 46 secs)
-> 174.3.217.172.in-addr.arpa
name = sea15s11-in-f14.1e100.net
ttl = 83026 (23 hours 3 mins 46 secs)
-> 174.3.217.172.in-addr.arpa
name = sea15s11-in-f174.1e100.net
ttl = 83026 (23 hours 3 mins 46 secs)
------------
Name: sea15s11-in-f14.1e100.net
Address: 172.217.3.174
命令6)nslookup -type=PTR 172.217.3.174
-此命令的版本指定带有-type
标志的PTR记录。它与不带-type
标志的版本在两个方面有所不同。首先是它列出了所有PTR答案。第二个是它包含其他命令忽略包括的信息“非权威性答案”。如果您在上面仔细查看调试输出的authority records
状态0,那么这两个命令都应显示“非权威性答案”。
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Non-authoritative answer:
174.3.217.172.in-addr.arpa name = sea15s11-in-f14.1e100.net
174.3.217.172.in-addr.arpa name = sea15s11-in-f14.1e100.net
174.3.217.172.in-addr.arpa name = sea15s11-in-f174.1e100.net
174.3.217.172.in-addr.arpa name = sea15s11-in-f174.1e100.net
命令7)nslookup -debug -d2 -type=PTR 151.101.1.69
-这是您如何获得有关完全反向查找请求的尽可能多的详细信息。提醒:要关闭它,请使用-nodebug
和-nod2
。此示例故意在serverfault.com示例上失败:
------------
SendRequest(), len 38
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: query, want recursion
questions = 1, answers = 0, authority records = 0, additional = 0
QUESTIONS:
8.8.8.8.in-addr.arpa, type = PTR, class = IN
------------
------------
Got answer (82 bytes):
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 0, additional = 0
QUESTIONS:
8.8.8.8.in-addr.arpa, type = PTR, class = IN
ANSWERS:
-> 8.8.8.8.in-addr.arpa
type = PTR, class = IN, dlen = 32
name = google-public-dns-a.google.com
ttl = 86280 (23 hours 58 mins)
------------
Server: google-public-dns-a.google.com
Address: 8.8.8.8
------------
SendRequest(), len 43
HEADER:
opcode = QUERY, id = 2, rcode = NOERROR
header flags: query, want recursion
questions = 1, answers = 0, authority records = 0, additional = 0
QUESTIONS:
69.1.101.151.in-addr.arpa, type = PTR, class = IN
------------
------------
Got answer (103 bytes):
HEADER:
opcode = QUERY, id = 2, rcode = NXDOMAIN
header flags: response, want recursion, recursion avail.
questions = 1, answers = 0, authority records = 1, additional = 0
QUESTIONS:
69.1.101.151.in-addr.arpa, type = PTR, class = IN
AUTHORITY RECORDS:
-> 151.in-addr.arpa
type = SOA, class = IN, dlen = 48
ttl = 1787 (29 mins 47 secs)
primary name server = pri.authdns.ripe.net
responsible mail addr = dns.ripe.net
serial = 1490512027
refresh = 3600 (1 hour)
retry = 600 (10 mins)
expire = 864000 (10 days)
default TTL = 3600 (1 hour)
------------
*** google-public-dns-a.google.com can't find 69.1.101.151.in-addr.arpa.: Non-ex
istent domain
命令8)nslookup 174.3.217.172.in-addr.arpa
-您可能想知道是否可以nslookup
像在命令1中那样使用传统的反向DNS查找方法dig
。您可以。请注意,在此命令与-type=PTR
下面设置了标志的命令(命令9)之间,出现了与我上面列出的(命令6)相同的nslookup故障:
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Name: 174.3.217.172.in-addr.arpa
命令9)nslookup -type=PTR 174.3.217.172.in-addr.arpa
-如您所料,它看起来与命令6相同。
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Non-authoritative answer:
174.3.217.172.in-addr.arpa name = sea15s11-in-f14.1e100.net
174.3.217.172.in-addr.arpa name = sea15s11-in-f14.1e100.net
174.3.217.172.in-addr.arpa name = sea15s11-in-f174.1e100.net
174.3.217.172.in-addr.arpa name = sea15s11-in-f174.1e100.net