How to Determine to Which Switch and Port You Are Connected

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.

7 Responses to “How to Determine to Which Switch and Port You Are Connected”

  1. February 14, 2009 at 4:01 pm, Tony said:

    Is there a method if you don’t have access (telnet) to the switch? Like the Fluke LinkRunner device.

    Reply

    • July 20, 2010 at 3:23 am, zinz said:

      is htere a way to source which ip addresses (device) is connected to which switch port??????

      Reply

  2. July 22, 2010 at 2:35 am, Cauley Shane said:

    Much thanks for the info!!!
    Shane Cauley Wyomingm

    Reply

    • October 18, 2010 at 8:29 am, Sobncr said:

      hi friends!!
      I was looking for such explanation since. Now i am ok but please in my office we have 3 cisco switch and in the show mac address table all of them has the mac address of my pc with different port
      the first show 1 0019.dbc0.cce6 DYNAMIC Fa0/24
      the second show 1 0019.dbc0.cce6 DYNAMIC Fa0/13
      the third show 1 0019.dbc0.cce6 DYNAMIC Fa0/24
      which port belong really to my pc ?
      thanks

      Reply

      • November 16, 2010 at 9:21 am, Bli said:

        Go back to the point of: “know your network”

        As switch1 and switch3 show you on Fa0/24 i assume that this is the uplink both use, therefore port13 on switch2 it is for you.

        Reply

  3. November 13, 2010 at 4:56 am, cindy said:

    MY COMMENT IS PUT.
    AN CCTV CAMERA IN THE MALLS.
    BECAuse SOME PEOPLE THEFT.
    insides the malls.

    Reply

  4. March 14, 2011 at 9:30 am, Weer said:

    Hi CAn u help me pls.I just want to know which port I have connected my pc.
    when i do sh ip arp..will get as follows,
    Protocol Address Age (min) Hardware Addr Type Interface
    Internet 1.1.1.1 13 0026.9914.e63f ARPA Vlan150
    Internet 192.168.80.80 158 0026.9914.e63f ARPA Vlan150
    Internet 192.168.80.81 227 0026.9914.e67f ARPA Vlan150
    Internet 192.168.40.50 103 0026.9914.e63f ARPA Vlan150
    Internet 192.168.80.77 114 0026.9914.e67f ARPA Vlan150
    Internet 192.168.80.68 181 0026.9914.e63f ARPA Vlan150
    Internet 192.168.80.160 106 0026.9914.e63f ARPA Vlan150
    Internet 192.168.150.12 50 0027.0d86.9cc1 ARPA Vlan150

    since my pc’s ip is 192.168.80.160, mac address is 0026.9914.e63f acording to the above details(actually this is not my pc’s mac.I checked it) .so now

    FirstFloor_SW1#sh mac address-table | include 0026.9914.e63f
    20 0026.9914.e63f DYNAMIC Te0/1
    31 0026.9914.e63f DYNAMIC Te0/1
    33 0026.9914.e63f DYNAMIC Te0/1
    50 0026.9914.e63f DYNAMIC Te0/1
    60 0026.9914.e63f DYNAMIC Te0/2
    70 0026.9914.e63f DYNAMIC Te0/1
    80 0026.9914.e63f DYNAMIC Te0/2
    150 0026.9914.e63f DYNAMIC Te0/1

    And Te0/1 and Te0/2 are uplinks.So what is the solution??How to find the port which I have connected to my pc??

    thx weer

    Reply

Leave a Reply