03-03-2012 02:17 AM - edited 03-07-2019 05:19 AM
Hi All
If I knew the IP address of a host, can we know on which port on the switch its connected. The switch model is 2960
thanks
Saquib
03-03-2012 02:32 AM
Hi,
1) if the host received an IP via DHCP go to the DHCP server to see the binding then you'll know the MAC address then go to the switch and look for the MAC address in the CAM table
2) if static IP go on the L3 device do a ping for the IP and look in the ARP cache for the MAC and then go to the switch and look for the MAC in the CAM table
Regards.
Alain
03-03-2012 02:46 AM
Hi Saquib,
I believe it can be done from switch itself - I have just tried it. First - you need to configure management ip address for switch. Then you have to ping the host and then check the arp and mac-address-table.
Example:
I know that ip of the host i am looking for has ip address 192.168.9.1 with mask 255.255.255.0 and is in vlan 1.
Therefore I assign vlan 1 management ip of 192.168.9.254 with mask 255.255.255.0.
Switch(config)#interface vlan 1
Switch(config-if)#ip add 192.168.9.254 255.255.255.0
Then I ping that host.
Switch#ping 192.168.9.1
Then you do show arp command.
Switch#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.9.1 0 000C.85B3.18BA ARPA Vlan1
Internet 192.168.9.254 - 0090.2B68.4E70 ARPA Vlan1
You will see the mac address of the machine and you can find out to which port is it attached to by simply looking it up in mac address table by command show mac-address-table
Switch#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0000.0c48.c776 DYNAMIC Fa0/2
1 000c.85b3.18ba DYNAMIC Fa0/1
And there you have it. Hope that helps.
Best regards,
Jan.
03-03-2012 04:26 AM
That will only work if the switch mgt ip is in the same subnet as the user you are looking for . If the switch is trunked and the mgt ip is in a different subnet that will not work.
03-03-2012 04:44 AM
I used to have to do this a fare few times to locate servers.
1) ping the host off another server/device(call this device A) in the same network.
2) Find the arp reply for the target server from the ARP table on the device used in step 1.
3) Then you will need to check the mac-address table on the switch attached to device A.
4) If there are multiple switches in the path, you will need to check each switch's mac-address table till you get to the access port.
03-03-2012 11:28 AM
Hi Glen,
Sure. But thank you for pointing that out. That's why I wrote an example where I assigned the management IP to the same vlan and subnet. I can't think of any other idea how to find host ip solely by using the switch.
Best regards,
Jan.
03-03-2012 06:35 AM
You can use the show Mac address-table command and find which port the host's Mac address is connected to. I also did | include 000f.1a to filter the results to only show the host I was looking for.
HTH
Sent from Cisco Technical Support iPhone App
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide