简体   繁体   English

使用dnsjava将给定IP解析为其主机名

[英]Using dnsjava to resolve a given IP to its Hostnames

I want to get a list of all registered Domains for a given IP Address . 我想获取给定IP地址的所有已注册域的列表。 Could I use PTR records. 我可以使用PTR记录。 I tried the following 我尝试了以下

ip = "217.13.68.220";
l = new Lookup(ip, Type.PTR );
l.setResolver(new SimpleResolver("8.8.8.8"));
l.run();

This IP should be resolved to zeit.de but the lookup returns: 该IP应该解析为zeit.de,但查找返回:

host_not_found 主机未找到

For an IPV4 address, you need to 对于IPV4地址,您需要

  1. Reverse the octets 反转八位字节
  2. Append the in-addr.arpa domain 附加in-addr.arpa域

So, in your case, you should pass "220.68.13.217.in-addr.arpa." 因此,对于您的情况,应传递“ 220.68.13.217.in-addr.arpa”。 to the resolver. 到解析器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM