Link to home
Start Free TrialLog in
Avatar of mulpeter
mulpeter

asked on

Retrieve IP addresses from Cisco Switch Ports

Looking to get the corresponding ip address of the switch port.
I run show ip arp and show mac address table on the switches and save results in seperate text files.
I then run a perl script on these files to retrieve the ip address, machine names , vlan etc.
problem is however not all ports are outputting arp details so only getting info on some ports
Does anyone know of a workaround to this problem
Avatar of pseudocyber
pseudocyber

You're only going to get ARP details matching an IP address to a port if in fact IP is running on the port in question.  In some cases, it might not be.
Entries will only be in the Mac Address table if a machine is connected to the port and is turned on and communicating on the network.  The entries age out so if a machine is turned off, its ARP/MAC entries will eventually age out and be removed from the tables.
Typically you would need to find it on one of your machine's arp tables.  If there is a router in your network, this is usually the most central place to gather that type of info.  On a cisco router, the command is "show arp" - it will give you a listing of the MAC addresses and their corresponding IP address.  On a windows box, from a DOS prompt you can type "arp -a" to see similar output.
i forgot to say.  switches (most) only work at layer 2, so they never see IP addresses. Routers work at Layer 3, so they learn IP addresses for use in the routing tables and such.
Avatar of Les Moore
If you have a router and a switch, you can use the ARP cache of the router.
Switch holds mac-address to switchport mapping - get the mac table
Router holds mac-address to IP address mapping - compare arp table to switch mac table
WINS/DNS holds IP address to NetBios host/user mapping - resolve IP's to netbios/host names

You need to use all three in concert to keep tabs on who's on first.

Take a look a Solarwinds switchport mapper. Free 30 day eval just to see how it works:
http://www.solarwinds.net
ASKER CERTIFIED SOLUTION
Avatar of PennGwyn
PennGwyn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial