Solved

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

Posted on 2009-04-06
2
380 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have seen some questions on problems with SSH/telnet access to Cisco routers that may occur despite the fact that from a PC connected to your LAN, Internet connectivity is in place and users can access Internet sites without any issues.  There are…
Getting hacked is no longer a matter or "if you get hacked" — the 2016 cyber threat landscape is now titled "when you get hacked." When it happens — will you be proactive, or reactive?
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now