Pcornel
Networking · Switching

Layer 2 Discovery

Cheat sheet · https://pcornel.dk/topic.php?topic=595

Back to the Topic

Answer

Layer 2 discovery protocols let directly connected devices announce themselves: CDP (Cisco) and LLDP (IEEE 802.1AB) send the device name, port, platform, addresses and capabilities to the neighbour on each link.

Remember

They only see direct neighbours. CDP is on by default on Cisco devices; LLDP must often be enabled with lldp run. Turn them off on ports towards untrusted networks, since they disclose platform and software details.

First checks

  • show cdp neighbors — neighbour device, local port, remote port, platform.
  • show cdp neighbors <if> detail — addresses, software version, native VLAN, duplex.
  • show lldp neighbors — the same for LLDP neighbours.
  • show lldp neighbors <if> detail — system name, port description, management address, capabilities.
  • show cdp interface / show lldp interface — where the protocols run.

Commands

show cdp neighbors
Summary
show lldp neighbors
Summary
show cdp neighbors detail
Detail
show lldp neighbors detail
Detail
show cdp
Global protocol
show lldp
Global protocol
show cdp interface
Interface protocol
show lldp interface
Interface protocol
show cdp neighbors <int>
show lldp neighbors <int>

Verify in this order

protocol enabled on both ends → advertisements sent on the link → neighbour entry created → device name and remote port match the design

Where it usually breaks

physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result

CDP vs LLDP

PropertyCDPLLDP
StandardCisco proprietaryIEEE 802.1AB
Scopedirectly connected linkdirectly connected link
Typical useCisco-centric topology discoveryvendor-neutral topology discovery
Global enablecdp runlldp run
Summaryshow cdp neighborsshow lldp neighbors
Detailshow cdp neighbors detailshow lldp neighbors detail
Provesadvertisement received from direct peeradvertisement received from direct peer
Does not proveVLAN/IP/end-to-end forwardingVLAN/IP/end-to-end forwarding

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=595

Confirmation

Confirm action

Continue?