Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a built-in command line tool that will do reverse DNS look-ups in Windows? I.e., something like <toolname> w.x.y.z => mycomputername

I've tried:

  • nslookup: seems to be forward look-up only.
  • host: doesn't exist
  • dig: also doesn't exist.

I found "What's the reverse DNS command line utility?" via a search, but this is specifically looking for a *nix utility, not a Windows one.

Thanks a lot!

share|improve this question
add comment

10 Answers

up vote 72 down vote accepted
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.

share|improve this answer
    
This worked better than nslookup as the conflicting machine is on another domain. Thanks a lot! –  alastairs Jul 15 '09 at 14:53
    
Worked like a charm –  Jacques Oct 8 '12 at 8:23
    
This doesn't work for me, maybe because I'm on the same domain. –  Kev Apr 16 '13 at 13:44
1  
in nslookup you can also try: set type=PTR <enter> w.x.y.z <enter> –  Peter May 10 '13 at 16:18
1  
@abstrask has the most complete answer –  vinnyjames Nov 18 '13 at 21:47
show 3 more comments

nslookup -type=ptr 10.1.x.x

share|improve this answer
add comment

nslookup will do reverse lookups in Windows.

C:\>nslookup star.slashdot.org

Server:  my-dns-server
Address:  10.242.0.1

Name:    star.slashdot.org
Address:  216.34.181.48

C:\>nslookup 216.34.181.48

Server:  my-dns-server
Address:  10.242.0.1

Name:    star.slashdot.org
Address:  216.34.181.48
share|improve this answer
add comment
nslookup <ip>

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

For example:

c:\>nslookup 192.168.101.39
Server: dns1.local
Address: 192.168.101.24

Name: enigma.local
Address: 192.168.101.39
share|improve this answer
2  
This was failing with a message "<DC> can't find w.x.y.z: Non-existent domain" and I couldn't work out why. I tried @Peter's answer, and found the conflicting machine was on another domain. –  alastairs Jul 15 '09 at 14:52
1  
It failed because nslookup only cares about DNS, while names in Windows can and will be resolved by other means if DNS isn't enough. –  Massimo Jun 3 at 17:50
add comment

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

share|improve this answer
2  
Good point that not all hosts will have a PTR record created for them –  Rowland Shaw Jul 16 '09 at 7:51
1  
Note that nslookup on Linux, BSD, and Windows do different things and are different programs. –  Good Person Dec 27 '12 at 18:35
    
If no PTR exists, you can whois the IP for more info..... prob doesnt ship with windoze either lol –  nandoP Jun 3 at 18:00
add comment

You can use the standard NSLOOKUP command:

nslookup 123.123.123.123

In order to get a result there has to be a PTR record registered for the IP address in question.

share|improve this answer
add comment

Use nslookup like this:

nslookup -type=PTR  127.0.0.1
share|improve this answer
add comment

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

or

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

share|improve this answer
add comment

Under Windows....

Standard ping does NOT return host name of IP address

NSLookup can be used to find this info, if DNS is setup properly

Procedure as follows:

Open DOS prompt

NSLookup

set type=ptr

a.b.c.d

Results will be shown with reverse DNS server address, and host name

share|improve this answer
add comment

9 answers and no one said how to reverse lookup with dig? Its the best

dig -x w.x.y.z

Also, you can add "+short" for use in bash loops, scripts, etc.... forward or reverse :)

share|improve this answer
    
No one has mentioned dig as it does not ship with Windows. The OP's question even indicates this. –  jscott Jun 3 at 17:39
1  
dig is generally the best choice DNS troubleshooting, though. I think there is definitely some value to suggesting a better tool even though it does not ship with Windows. (Available in the Windows builds at isc.org/software/bind) –  Håkan Lindqvist Jun 3 at 17:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.