Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I find on which port is connected specific IP address

Status
Not open for further replies.

debcu

Technical User
Sep 3, 2004
48
PL
Hello,
my question is "how can I find on which port is connected specific IP address". I have 6 Cisco switches (WS-2950G-48-EI) and I would like to know how can I find port where specify IP is connected for example IP 10.39.220.20.
Thanks for help.
 
Firstly you will need to discover what the mac address is for the IP address in question.

if the switch's management address also belongs to the 10.39.220.0 subnet, you can ping the host in question from the switch and issue the 'show arp' command to discover the MAC address. Once you have the MAC address, you can issue the 'show mac-address-table' command to see which MAC address is connected to which physical port.

If the switch management address is NOT part of the IP subnet of the host you are looking for, connect to your default gateway router and again ping the host you are looking to discover. Then issue the 'show arp' command again on the default gateway to discover the MAC address then connect to each switch and use the 'show mac-address-table' command as above to locate the physical port it is connected to.
 
And if you are a lucky man you enabled SNMP on the switches and on the default gateway router.
If this is the case you can use the 'cammer' script from Tobias Oetiker. It is a Perl script. This script reads the MAC addresses from the switch and matches it with the ARP table from the default gateway router.
Take a look at and scroll down to find the cammer.readme.txt and the script cammer.
Use the following syntax:
perl cammer SNMPreadString@Switch SNMPreadString@defaultgateway >cammer.txt
You then end up with a cammer.txt filled with the MAC addresses per switchport and the corresponding IP addresses.
It helped me a few times.
 
Theres 2 major steps to find the source port of an IP address in your scenario:

1 - Check your directly connected router's ARP cache:

show arp | include 10.39.220.20

This should tell you the MAC address of that IP.

2 - Check your 2950's MAC-address table:

show mac-address-table | i 0000.1111.2222 (the MAC address you got from the previous step).

This should tell you which switchport the source IP is coming from. Basically you use ARP on the router to map the IP to a MAC address, then use that MAC address on your switch's "show mac-address-table" to see which port the MAC address is connected to.



-Rainman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top