Resolve host name from IP address
I'm looking for a command line tool which gets an IP address and returns the host name, for Windows.
The command you are looking for is called nslookup
, works fine for reverse lookups IFF someone has configured a reverse zone file, which they don't always do.
if all the above fails, and you are specifically looking for a Windows machine, you can use
nbtstat -a 192.168.1.50
The data returned will be all the NetBIOS records the machine has. The one with a <20h> record type will usually be the machine's name.
For many IP addresses you could just use ping -a, for example
ping -a 209.85.229.106
will return
Pinging ww-in-f106.google.com [209.85.229.106] with 32 bytes of data:
Reply from 209.85.229.106...........
If you use nslookup command with the IP address as its first argument will return the PTR record (the reverse entry) if it exists. For example:
nslookup 192.168.1.50