Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do you search for an IP address given a MAC address, on a Cisco switch?

Posted on 2009-04-06
2
Medium Priority
?
413 Views
Last Modified: 2012-05-06
I have to develop a scrip that will find an IP address given a MAC address on a Cisco switch. The script must be written for a Unix server and run in intervals of about 30 minutes.

I should say that I am a complete novice in this matter, but I am a quick learner.

The issue is, I live on a small island, and my MacBook Pro was stolen, but I have my MAC address. The local ISP will help me locate the laptop if I write a script to associate an IP with my MAC. It should run about every 30 seconds and notify both the network administrator and me.  I am a programmer but this is unfamiliar territory for me. I would greatly appreciate some guidance.  
0
Comment
2 Comments
 
LVL 11

Accepted Solution

by:
grsteed earned 800 total points
ID: 24084152
If the switch is only layer 2, than you may not be able to see the IP address unless it happens to be on the same network that switch management IP address is on. That is, the same network that you telnet/ssh to  when accessing the switch console. If you issue the command "show arp" or "show ip arp" you will see the MAC's and IP's for that network.  If it's a long list use the form "show ip arp | in <MAC>" where in=include and <MAC> is your MAC address.   If you don't see your MAC listed that way, you can try the command "show mac-address-table dynamic | in <MAC>"  That will show you if you MAC shows up on a port on that switch, of a trunk/port channel that connects to another switch. If that's what you see, you need to go to the next switch and issue the same command.  This will eventually get you to the port that your laptop is showing up on.

The best place to get MAC -> IP information is from the router arp cache, or the arp cache of a layer 3 switch with the command "show ip arp | in <MAC>"

To run this from a Unix server, you may want to use TCL/Expect which uses  SEND and EXPECT commands to send a string and wait for a string back.  With it you can script a telnet/ssh to a device, wait for login prompt, send login, wait for password prompt, send password, wait for prompt, send command, wait for output etc...  a sample can be found here.

http://www.corecoding.com/cisco-expect-script_c32.html

Hope this helps.

Gary

0
 
LVL 11

Assisted Solution

by:atlas_shuddered
atlas_shuddered earned 200 total points
ID: 24097956
One other item of note, if the switch in question is capable of running the Cisco Network Assistant, you can perform a layer 2 trace.  The downside to this is that it will not run automatically.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an OSPF network that automatically (dynamically) reroutes network traffic over other connections to prevent network downtime.
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question