I have a list of IPs. I need to make reveres DNS, i.e, I want the website name.
I tried the following:
InetAddress addr = InetAddress.getByName("98.138.253.109");
String host = addr.getCanonicalHostName();
System.out.println(host);
But, the IP in my example is for yahoo.com, when I run the code, I get: ir1.fp.vip.ne1.yahoo.com
I need a way so I can get the domain name by entering the IP.
The IP Address in the code your provided resolves to yahoo because it is held by yahoo.
The Ip address you are using is designated for only one host. As you can imagine yahoo probably has thousands of servers. They get assigned an allocation of ipaddresses which they then reuse as they see fit for internal allocation. The different servers under yahoo domain have different names and hence when you reference an ip address from a specific server you get the name for that specific server. For the general ipaddress for yahoo.com that might be hidden unless you want to to a nslookup and query a whole range of ipaddress to find yahoo.com allocations and generalize from there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With