KB ID 0001289
If you’re running Cisco IOS on all you devices then you can use CDP to see what’s directly connected, (unless you are on a Cisco firewall, but I did say IOS devices).
Petes-Switch#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID Petes-CPE.petenetlive.com Gig 1/0/19 148 R S I CISCO2901 Gig 0/0 Petes-Switch#
But just about every other vendor uses LLDP (Link Layer Discovery Protocol,) to do the same job. So how do you discover what ports you are plugged into on them, or what they are?
Well in most cases, (depending on your code) your devices also support LLDP, it’s just disabled by default. You simply turn it on with an ‘lldp run’ command.
Petes-Switch(config)#lldp run Petes-Switch(config)#exit Petes-Switch#show lldp ? entry Information for specific neighbor entry errors LLDP computational errors and overflows interface LLDP interface status and configuration neighbors LLDP neighbor entries traffic LLDP statistics | Output modifiers
Now I see my neighbours, (yes that is how it’s spelt I’m English!) In my example below the neighbour is a Dell Switch.
Petes-Switch#show lldp neighbors Capability codes: (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other Device ID Local Intf Hold-time Capability Port ID 90b1.1cf4.39e1 Gi1/0/11 120 ManagementEthernet 0/0 90b1.1cf4.39e1 Gi1/0/14 120 TenGigabitEthernet 1/45 90b1.1cf4.39e1 Gi2/0/13 120 TenGigabitEthernet 0/44 90b1.1cf4.39e1 Gi1/0/13 120 TenGigabitEthernet 1/44 90b1.1cf4.39e1 Gi2/0/14 120 TenGigabitEthernet 0/45 90b1.1cf4.39e1 Gi1/0/16 120 TenGigabitEthernet 1/47 90b1.1cf4.39e1 Gi2/0/16 120 TenGigabitEthernet 0/46 90b1.1cf4.39e1 Gi1/0/15 120 TenGigabitEthernet 1/46 90b1.1cf4.39e1 Gi2/0/15 120 TenGigabitEthernet 0/47 Total entries displayed: 9