Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Mac to IP tcl


Have anyone come across a script that could yield the IP address of a given mac-address when invoked on a Layer 3 Router?

I would assume that you would have to select the given interface (as it could be any interface) and the router should start arp-ing all hosts on a given subnet returning the result when finished executing the script?

Assumptions is that you know the logical subnet where the mac-address reside or maybe it could be invoked with a "all" interface command to run the script on all logical interfaces.

Anyone seen it?                  

Cisco Employee

Mac to IP tcl

Such a script would not be possible as you have outlined.  There would need to be a RARP CLI to get an IP address when you know ones MAC.  What could work is to ping sweep every subnet on a device to build an ARP table.  Then you could do a lookup in the table to find the MAC.  This would be quite inefficient, especially on a device with a number of interfaces or with large subnets.

In short, it could be done, but I'm not sure it would work as well as you hope.

New Member

Mac to IP tcl


I appreciate your swift answer, thank you very right!

You are completely right - technically that's also the only way i could figure it out. The ARP-ing => Ping-sweaping the subnet.

I realisize it could be inefficient therefore i would like to specify the logical interface.

Do you have any good starting points?

There might also be other ways to accomplish this

Best regards


Cisco Employee

Mac to IP tcl

Even knowing the interface you could have a long-running script as each IP may need to be pinged.

My approach to this would be to frist look at show arp to see if the MAC is already known.  If so, print the IP and you're done.  If not, get the IP and mask on the specified interface.  Get the first host address in that subnet and ping it with the parameters:

ping ip ${ip} repeat 1 timeout 0

After each ping, check the ARP cache again to see if the MAC has been learned.  Repeat until you find the matching ARP entry.

New Member

Mac to IP tcl

I use a java program to run some tasks such as show arp table on L3 switches. outputs are saved to local file for later search.

I‘m new to EEM, I think you can also use EEM to show arp table and send output to a centralized data server, then you can use other tools such as GREP to find the IP <--> MAC relationship.

Cisco Employee

Re: Mac to IP tcl

Sure, this is possible.  You can do something simple if you wanted to do that:

event manager send-arp

event timer watchdog time 14400

action 1.0 cli command "enable"

action 2.0 cli command "show arp"

action 3.0 mail to "" from "" subject "ARP Table" server "" body "$_cli_result"

This will send the ARP table via email every four hours.

New Member

Re: Mac to IP tcl

I need script that execute show arp command, and if there dynamically arp entries. Script converts dynamic to static ?