2.3 Configure and verify CDP and LLDP neighbor discovery

CCNA 200-301 v1.1 · 2.0 Network Access

CDP (Cisco) and LLDP (IEEE 802.1AB) let directly connected devices announce who they are: hostname, model, port, addresses and capabilities. They are the first tools for drawing an unknown network and checking that cables go where the diagram says. CDP is on by default on Cisco gear; LLDP is not.

What you must know

What the protocols share

Both send small Layer 2 frames on each interface at a fixed interval to a multicast MAC address. Neighbors store what they hear and forget it when the hold time expires. Neither crosses a router or a switch: you only see the device on the other end of the cable.

CDPLLDP
StandardCiscoIEEE 802.1AB
Default on Cisco IOSOnOff
Advertisement timer60 s30 s
Hold time180 s120 s
Enable globallycdp runlldp run
Per interfacecdp enablelldp transmit / lldp receive

Reading the neighbor table

SW1# show cdp neighbors
Capability Codes: R - Router, S - Switch, H - Host, I - IGMP, P - Phone
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R1               Gig 0/24          152             R I    ISR4331   Gig 0/0/1
SEP001A2B3C4D5E  Gig 0/3           139            H P M   IP Phone  Port 1

show cdp neighbors detail (or show cdp entry R1) adds the neighbor's IP addresses, IOS version, native VLAN and duplex, which is how you find a router's address when you only have console access to the switch. show lldp neighbors detail gives the same for LLDP, including the system name and description.

Configuring and securing

lldp run
!
interface GigabitEthernet0/1
 no cdp enable
 no lldp transmit
 no lldp receive
!
cdp timer 30
cdp holdtime 90

Discovery frames reveal models and software versions, which helps an attacker pick an exploit. Turn them off on ports facing the internet, guests or other organisations, and keep them where phones and neighbors need them (phones learn their voice VLAN through CDP or LLDP-MED).

Commands

show cdp neighbors [detail]Directly connected Cisco devices, their ports, platforms and (with detail) addresses.
show cdp interfaceInterfaces running CDP and the timers.
show lldp neighbors [detail]The same for LLDP neighbors.
show cdp traffic / show lldp trafficFrames sent and received, to see whether a neighbor talks at all.

Exam traps

Check yourself

Which command shows the IP address of the router on a switch's Gi0/24?
show cdp neighbors detail (or show cdp entry <name>).
A Linux server is on Gi0/10 but does not appear in show cdp neighbors. Why, and what do you use?
It does not speak CDP. Enable lldp run and check show lldp neighbors.
What are the default CDP timer and hold time?
60 seconds and 180 seconds.

Labs

Try it live: Secure device access: passwords, SSH, CDP and LLDP

More topics in 2.0 Network Access