What's the command-line utility in Windows to do a reverse DNS look-up?

Solution 1:

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.

Solution 2:

nslookup <ip>

Does what you're looking for. It will tell you the server you're querying and the result.

For example:

Server: dns1.local

Name: enigma.local

Solution 3:

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


nslookup 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.

See also

  • Tech-FAQ: NetBIOS Node Types
  • Wikipedia: NetBIOS: Node types
  • Microsoft: TCP/IP and NBT configuration parameters for Windows XP (search for "NodeType")

Solution 4:

Use NSLOOKUP with the "-type=ptr" parameter to query the IP address, syntax:

nslookup -type=ptr

Then the "in-addr.arpa" entry is also printed (even when not found), for example:

C:\Users\UserName>nslookup -type=ptr
Server:  MyDnsServerName
Address:  X.X.X.X

Non-authoritative answer:    name = google-public-dns-a.google.com

Compared to the lower fidelity response when using NSLOOKUP on an IP address without the type parameter:

Server:  MyDnsServerName
Address:  X.X.X.X

Name:    google-public-dns-a.google.com

Solution 5:

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