05-24-2012 11:23 PM
Gents,
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?
05-24-2012 11:32 PM
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.
05-24-2012 11:45 PM
Joseph,
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
Ulrich
05-25-2012 07:44 AM
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.
06-12-2012 11:03 PM
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.
06-16-2012 01:24 PM
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 "user@example.com" from "user@example.com" subject "ARP Table" server "10.1.1.1" body "$_cli_result"
This will send the ARP table via email every four hours.
05-15-2013 08:31 AM
I need script that execute show arp command, and if there dynamically arp entries. Script converts dynamic to static ?
IP to MAC
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide