How to Determine to Which Switch and Port You Are Connected

Posted May 4, 2005 by Caveman in Cisco switch

Sometimes you need to know to which switch and port you are connected. I work for a community college with hundreds of switches. Here is a method I have found to work well.


Pick a switch you think might be a likely candidate and telnet in.

> telnet 10.10.125.5

Once you are logged in to the switch, go to Privileged EXEC mode.

rssv125-sw5> enable

Look in the MAC address table to find your computer’s MAC address.

rssv125-sw5# show mac-address-table address 0002.3F39.BFE6

You will get a response similar to this:

Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
59 0002.3f39.bfe6 DYNAMIC Fa0/24
Total Mac Addresses for this criterion: 1

If your port is a FastEthernet port (Fa0/nn) as this example shows, you know that you are connected to FastEthernet port 0/24 on switch 10.10.125.5 (rssv125-sw5).

However, many times you will get a response similar to this:

Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
59 0002.3f39.bfe6 DYNAMIC Gi0/1
Total Mac Addresses for this criterion: 1

The Gi0/n indicates you are connected to a gigabit port. Since the gigabit ports only go to other switches, you know you are connected to another switch. To see what the neighboring switches are, use CDP (Cisco Discovery Protocol).

rssv125-sw5# show cdp neighbor Gi0/1 detail

The response should be something similar to this:

Device ID: rssv125-sw4
Entry address(es):
IP address: 10.10.125.4
Platform: cisco WS-C3550-24-PWR, Capabilities: Switch IGMP
Interface: GigabitEthernet0/1, Port ID (outgoing port): GigabitEthernet0/1
[snip]

Now, go back to the telnet step above and run through it again, but this time, use the 10.10.125.4 IP address from the show cdp neighbor output. Repeat until you find the switch and port to which you are connected.

The Conversation

Follow the reactions below and share your own thoughts.