On Mar 4, 2008, at 10:35 PM, Christopher Hegarty wrote:
Hi Max,
The Java methods that you are using are correct. As it is specified
"best effort" is used to determine the FQDN.
getByName will try to do forward lookup of k1.n3.local to retrieve
its address, which I assumes will succeed. Then this address is
used to do a reverse lookup to determine the FQDN of the host. What
name service are you using? Can you verify the response from the
server to the reverse lookup?
It's the Windows DNS service automatically installed when I add the
"AD domain controller" role to the AD server. The "Reverse Lookup
Zones" is empty in the DNS Management Administrative Tools.
BTW, I have 2 domains in the Network, one is this n3.local, another
is a "sub-domain" n8.n3.local managed by another AD server. The
client/AD server/k1 all belongs to n3.local. This shouldn't confuse
the client, right?
Here's the output of on my client machine xp. The other machines are:
kdc, the AD server, and k1, the other server. D prints out
InetAddress.getByName(args[0]).getCanonicalHostName(). You can see
that getCanonicalName() costs quite some time accessing k1 and kdc.
Ping is fast anyway.
C:\tmp>"\Program Files\MKS Toolkit\mksnt\time.exe" java D xp
xp.n3.local
real 0m 0.34s
user 0m 0.06s
sys 0m 0.22s
C:\tmp>"\Program Files\MKS Toolkit\mksnt\time.exe" java D k1
K1
real 0m15.51s
user 0m 0.03s
sys 0m 0.29s
C:\tmp>"\Program Files\MKS Toolkit\mksnt\time.exe" java D kdc
KDC
real 0m15.35s
user 0m 0.02s
sys 0m 0.26s
C:\tmp>ping k1
Pinging k1.n3.local [192.168.0.11] with 32 bytes of data:
Reply from 192.168.0.11: bytes=32 time<1ms TTL=128
Reply from 192.168.0.11: bytes=32 time<1ms TTL=128
Reply from 192.168.0.11: bytes=32 time<1ms TTL=128
Reply from 192.168.0.11: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.0.11:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\tmp>ping kdc
Pinging kdc.n3.local [192.168.0.1] with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Thanks
Max
-Chris.
Max (Weijun) Wang wrote:
Hi All
I have a Windows domain called n3.local, and a server called k1 in
the domain, and a client. When I call the line --
InetAddress.getByName("k1.n3.local").getCanonicalHostName()
from the client, the returned string is "k1". How can I get
"k1.n3.local"? Is there anything wrong with my Windows
configuration? Or, I should use another Java method?
Thanks
Max