Solved

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

Posted on 2009-04-06
2
386 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 200 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 10

Assisted Solution

by:atlas_shuddered
atlas_shuddered earned 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

I eventually solved a perplexing problem setting up telnet for a new switch.  I installed a new Cisco WS-03560X-24P switch connected to an existing Cisco 4506 running a WS-X4013-10GE Sup II-Plus. After configuring vlans and trunking,  I could no…
Network ports are the threads that hold network communication together. They are an essential part of networking that can be easily ignore or misunderstood, my goals is to show those who don't have a strong network foundation how network ports opera…
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…

821 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