通过域名,查找对应的ip地址
nslookup redhat.com Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: Name: redhat.com Address: 209.132.183.105
现在通过ip地址,查找域名
网上介绍了下面的两种方法。
方法1:使用nslookup
nslookup 209.132.183.105 Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: 105.183.132.209.in-addr.arpa name = redirect.redhat.com. Authoritative answers can be found from:
方法2:使用dig -x
dig -x 209.132.183.105 ; <<>> DiG 9.9.5-9+deb8u7-Debian <<>> -x 209.132.183.105 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62599 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1280 ;; QUESTION SECTION: ;105.183.132.209.in-addr.arpa. IN PTR ;; ANSWER SECTION: 105.183.132.209.in-addr.arpa. 519 IN PTR redirect.redhat.com. ;; Query time: 1 msec ;; SERVER: 192.168.1.1#53(192.168.1.1) ;; WHEN: Sat Nov 19 15:11:33 CST 2016 ;; MSG SIZE rcvd: 90
两种方法得到的结果一样,都是 redirect.redhat.com。
因为 nslookup ip-address 或者 dig -x ip-address,都是获得这个ip地址的PTR记录。
从结果也可以看出,本来,我们需要的结果是 redhat.com ,他们得到的结果是 redirect.redhat.com
redirect.redhat.com 是209.132.183.105的PTR记录。
结论:无法通过ip地址查找对应的域名
Who said that domain names can be searched by IP?
We didn’t pay the upstream to do PTR, so your IP reverse-checked the domain name, and it didn’t even find in-addr.arpa. Except Public DNS built by yourself
I’d love to know how you set up reverse parsing