You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by wi...@mailops.com on 2001/07/06 19:28:19 UTC

Re[4]: Reverse DNS lookup

Friday, July 06, 2001, 12:15:19 PM, dwall@myEastside.com wrote:

>> RL>         The InetAddress...getHostName() call will use the DNS
DW> databases.
>> RL> For most computers, however, this won't return anything useful.
>>
>> That is not true. Most of US IPs have PTR records. That includes your
>> own IP, that you had when sending your msg. By far, most servers have
DW> rDNS,
>> most dynamic IPs do, most static IPs for cable/DSL do, and even most
DW> routers
>> do.

DW> The IP address I was testing is 216.122.43.90 and I am able to do a reverse
DW> lookup using dig from the webserver.  It just seems to me that the
DW> InetAddress class is perhaps not using whatever it needs to do to use DNS.
DW> Does anybody know what the implementation of InetAddress is actually doing
DW> under the hood?

Well, the InetAddress methods do work correctly, Dave. Here is a quick demo:

import java.net.*;

public class IPGet {

    public static void main(String[] args) {
        try {
            System.out.println(InetAddress.getByName(args[0]).getHostName());
        } catch (Exception e) {
            System.out.println(e);
        }
    }

}

and the console:

C:\test>jikes -nowarn IPGet.java

C:\test>java IPGet 216.122.43.90
r90-43-dsl.sea.lightrealm.net

Now, for the kicker... On one run I got the same return as you
did: the IP number instead of hostname - this happens when the lookup
fails. Therefore, I would guess right now that here might be some problem
in the nameservers at lightrealm.

So, a partial dig shows:

Dig 90.43.122.216.in-addr.arpa@199.224.86.20 ...
Authoritative Answer
Recursive queries supported by this server
 Query for 90.43.122.216.in-addr.arpa type=255 class=1
  90.43.122.216.in-addr.arpa PTR (Pointer) r90-43-dsl.sea.lightrealm.net
  43.122.216.in-addr.arpa NS (Nameserver) ns1.lightrealm.net

  and next:

07/06/01 12:50:19 ping ns1.lightrealm.net
Ping  failed, no such host  

That looks like a slam dunk. Lightrealm's problem, when they
periodically can't resolve within their domain. Not a Java problem.
HTH.

DW> David



Re: Re[4]: Reverse DNS lookup

Posted by David Wall <dw...@myEastside.com>.
Thanks for all the help.  It wasn't my code or my ISP, but a security
manager problem...

Turns out the problem was a security permission I needed to define:

 permission java.net.SocketPermission "*", "resolve";

What's unusual is that no exception was thrown to make that clear.  It just
"failed silently."

David