我知道我们可以dig -x
用来执行反向DNS查询。
我面前有一本教科书,上面提到这两个dig ptr
和dig -x
都是有效的语法。
dig -x
肯定对我有用,但是我没有得到答案dig ptr
:
~ $ dig ptr 216.239.34.10
; <<>> DiG 9.8.3-P1 <<>> ptr 216.239.34.10
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 41447
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;216.239.34.10. IN PTR
;; AUTHORITY SECTION:
. 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2016113001 1800 900 604800 86400
;; Query time: 325 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Nov 30 20:17:10 2016
;; MSG SIZE rcvd: 106
~ $ dig -x 216.239.34.10
; <<>> DiG 9.8.3-P1 <<>> -x 216.239.34.10
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13022
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;10.34.239.216.in-addr.arpa. IN PTR
;; ANSWER SECTION:
10.34.239.216.in-addr.arpa. 86400 IN PTR ns2.google.com.
;; AUTHORITY SECTION:
34.239.216.in-addr.arpa. 83894 IN NS ns1.google.com.
34.239.216.in-addr.arpa. 83894 IN NS ns4.google.com.
34.239.216.in-addr.arpa. 83894 IN NS ns2.google.com.
34.239.216.in-addr.arpa. 83894 IN NS ns3.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 327096 IN A 216.239.32.10
ns2.google.com. 327096 IN A 216.239.34.10
ns3.google.com. 327096 IN A 216.239.36.10
ns4.google.com. 327096 IN A 216.239.38.10
;; Query time: 17 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Nov 30 20:17:18 2016
;; MSG SIZE rcvd: 204
教科书是错误的还是过时的?
dig ptr
确实有效,如果您将其用作dig ptr 10.34.239.216.in-addr.arpa.