DNS reverse lookup

Joseph S D Yao jsdy at cospo.osis.gov
Tue May 16 22:55:00 UTC 2000


On Tue, May 16, 2000 at 12:23:38PM -0500, Martin wrote:
...
> 1/ Is it possible to do a reverse DNS in Java code.

Yes.  Turing rule.

> 2/ I have tried the following code, and it does not work – 

This code seems odd to me.  This may just be because I do not yet know
Java.  ;-)

> InetAddress r; 

Could you tell us the quick specs for the InetAddress methods
getByName(), getByAddr(), and getHostName()?

>            r = InetAddress.getByName("192.122.98.61"); 

In Java, can you call a method by reference off of the class name,
instead of off an object of the class?  Is this really the function to
convert a string with a dotted-quad representation of an IP address
into the 32-bit InetAddress representation?  It seems to me that you
would want to be saying:

	r = InetAddress("192.122.98.61");

but that may just be the C++/ECL constructor functions in my brain
speaking.

>            s = r.getHostName();     

This is where I would think getByAddr() might be used ... but it might
return an array of strings, instead of a single string.  If it follows
the C library model.

> 3/ If it is not possible, how else can I do it?. I have tried to 
> use Windows NT's  - 
> nslookup <ipaddress>.in-addr.arpa

This would not work, anyway.  You need to REVERSE the IP address.
	nslookup 61.98.122.192.in-addr.arpa
or, if it behaves like Unix 'nslookup', just say:
	nslookup 192.122.98.61
and it will do all the rest.  A fact that annoys some.  ;-)

> and this doesn't work either! Has this anything to do with the 
> fact that I am behind a firewall??

Possibly.  But it is quite possible to resolve IP addresses from behind
a reasonably secure firewall, if it is properly configured.  You can
browse Internet sites, can't you?  ;-)

-- 
Joe Yao				jsdy at cospo.osis.gov - Joseph S. D. Yao
COSPO/OSIS Computer Support					EMT-B
-----------------------------------------------------------------------
This message is not an official statement of COSPO policies.



More information about the bind-users mailing list