Wednesday, May 4, 2011

Finding an IP Address

Have you ever been in a situation where you know the physical address, i.e. MAC address, of a local network device but not its IP address? This post tells you how to go about to find that elusive address. The instructions below are for Windows but is easily ported to any OS, since the tools used are ubiquitous.

  1. Create a batch file pingsubnet.cmd that contains the following statement
  2. @FOR /L %%h IN (1,1,255) DO @ping -n 1 %1.%%h
    This will loop from 1 to 255 to send a single echo request to the IP addresses you get from concatenating the subnet parameter and the for loop variable (%1.%%h). This assumes that the subnet is a class C subnet.
  3. Execute pingsubnet for your subnet.
  4. Execute the following command
    arp -a > arp.txt
    The command arp, which name stands for Address Resolution Protocol, will list the IP address and MAC address of every local network device you've communicated with.
  5. Open the file arp.txt and search for the MAC address of the device  with an unknown IP address.
  6. Having found the MAC address you have also found the IP address!

No comments:

Post a Comment