What's the command-line utility in Windows to do a reverse DNS look-up?
ping -a w.x.y.z
Should resolve the name from the IP address if the reverse lookup zone has been set up properly. If the reverse lookup zone does not have an entry for the record, the
-a will just ping without a name.
Does what you're looking for. It will tell you the server you're querying and the result.
c:\>nslookup 192.168.101.39 Server: dns1.local Address: 192.168.101.24 Name: enigma.local Address: 192.168.101.39
The trouble with "ping" is that it's not strictly a name server lookup tool (like nslookup) - for instance if you ping a hostname, it can be resolved to an IP address by a number of methods: DNS lookup, host file lookup, WINS (god forbid) or NetBIOS broadcast. It can also return a potentially out-dated cached result.
The order in which the methods are tried, depends on the clients' TCP/IP configuration and node type flag:
- B-node (1): Broadcast
- P-node (2): Peer (WINS only)
- M-node (4): Mixed (broadcast, then WINS)
- H-node (8): Hybrid (WINS, then broadcast)
To see the node type of the current computer:
C:\>ipconfig /all | find "Node Type" Node Type . . . . . . . . . . . . : Hybrid
If the resolution method is of no concern, use
ping -a w.x.y.z
as you please. If you need to be sure you're querying your DNS server for the correct name, use nslookup.
- Tech-FAQ: NetBIOS Node Types
- Wikipedia: NetBIOS: Node types
- Microsoft: TCP/IP and NBT configuration parameters for Windows XP (search for "NodeType")
Use NSLOOKUP with the "-type=ptr" parameter to query the IP address, syntax:
nslookup -type=ptr 188.8.131.52
Then the "in-addr.arpa" entry is also printed (even when not found), for example:
C:\Users\UserName>nslookup -type=ptr 184.108.40.206 Server: MyDnsServerName Address: X.X.X.X Non-authoritative answer: 220.127.116.11.in-addr.arpa name = google-public-dns-a.google.com
Compared to the lower fidelity response when using NSLOOKUP on an IP address without the type parameter:
C:\Users\UserName>nslookup 18.104.22.168 Server: MyDnsServerName Address: X.X.X.X Name: google-public-dns-a.google.com Address: 22.214.171.124
nslookup will do reverse DNS on windows just as it can do it on linux.
Of course, there isn't a reverse entry for every ip address