Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get IP address from the MAC address

Status
Not open for further replies.

siulong2002

Programmer
Jan 15, 2003
38
GB
Hi

I was just wondering if anyone new of anyway to get the IP address from the MAC address.

Any help would be appreciated

 
An RARP request does that (a reverse ARP) but I don't know how you actually make an RARP request.
 
Unless it's multicast, you can't. The MAC address is layer 2 and the IP address is layer 3. Hosts, routers, etc. generally keep an ARP cache that maps layer 2 and 3 addresses. But an IP is only embedded in a MAC in the special case of multicast.

 
ping -b broadcast_addr
arp -a |grep <mac address>

The ping -b allows you to ping the broadcast address for a subnet and all hosts on that subnet should reply, yeilding a list of IP addresses and populating your ARP cache.

arp -a lists all addresses in the arp cache, and grep allows you to display only the one with the MAC address that you are seeking.

There is another thread along the same lines already running on this forum.

Or even better, use arping to check the MAC addresses of every device on your subnet. A simple perl or shell script will do the trick!
pansophic
 
Note: do realize, that you can find out IP from MAC on your local subnet ONLY.

Step 1 - ping your subnet's broadcast address (depends on your network IP class)

Step 2 - run

arp -a

and it will give you full list of your subnet's MACs and IPs.

Good luck.
 
You may want to try SolarWinds then. I believe that it will do what you want. Or just boot with a Linux bootable CDROM like the BBC or LBT (on Linuxcare.com).
pansophic
 
Here's the link: thread581-436526 two perl scripts in there, and a batch file as well that will match up all your IPs and their MACs. Once any three of the scripts are run, just view the output to find the MAC address you need.
[thumbsup2] ________________________________________
Check out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top