I'm not familiar with networking and have been trying to search for info online. From what I have found, there's no possible way to find out the particular physical port of a switch that a computer is connected to w/o accessing the switch?

Am I getting my facts right?


Yes. At least, to the extent of my knowledge. You have two ways of determining the physical port - accessing the switch and determining it logically, or tracing the cable and determining it physically. Both require some form of "access" to the switch.

| improve this answer | |

Depending on the make and model (and configuration) of the switch, it may be possible to get this information from the computer. Most enterprise-class switches (e.g. Cisco Catalyst, HP Procurve, etc.) support one or more network discovery protocols, such as CDP or LLDP. In some cases, they're on by default. The computer normally ignores these discovery protocols, but it's possible to capture the data using a packet sniffer, or in the case with LLDP, actually running an LLDP server.

For example, most of the switches where I work are various Cisco Catalyst models, all of which support CDP. We commonly use a packet sniffer to capture CDP packets to determine which switch and port a particular PC is connected to. Though I haven't worked out how to do it, it should be possible to construct a similar filter to capture and decode LLDP packets as well.

| improve this answer | |
  • 2
    Wireshark can decode both CDP and LLDP. The Port information can be available in both, though it's optional in the protocol specification. – Chris S Feb 21 '13 at 15:14
  • In LLDP it's mandatory to send a Port ID to the recipient. – Matt Feb 26 '13 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.