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
- Read
show cdp neighborsandshow cdp neighbors detail. - Enable and disable CDP and LLDP globally and per interface.
- Explain the timers and why the two protocols coexist.
- Say why discovery protocols are turned off on ports facing untrusted networks.
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.
| CDP | LLDP | |
|---|---|---|
| Standard | Cisco | IEEE 802.1AB |
| Default on Cisco IOS | On | Off |
| Advertisement timer | 60 s | 30 s |
| Hold time | 180 s | 120 s |
| Enable globally | cdp run | lldp run |
| Per interface | cdp enable | lldp 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 1show 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 90Discovery 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 interface | Interfaces running CDP and the timers. |
show lldp neighbors [detail] | The same for LLDP neighbors. |
show cdp traffic / show lldp traffic | Frames sent and received, to see whether a neighbor talks at all. |
Exam traps
- In
show cdp neighbors, Local Intrfce is your port and Port ID is the neighbor's. - LLDP is off by default on Cisco IOS:
lldp runfirst. - CDP and LLDP only see directly connected neighbors.
- CDP holdtime 180 s: a removed neighbor can stay in the table for three minutes.
Check yourself
- Which command shows the IP address of the router on a switch's Gi0/24?
show cdp neighbors detail(orshow 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 runand checkshow 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
- 2.1 Configure and verify VLANs that span several switches
- 2.5 Interpret how Rapid PVST+ spanning tree operates
- 2.6 Describe how Cisco wireless is architected and what each AP mode does
- 2.7 Describe how APs, WLCs and switch ports are physically connected, including LAG
- 2.8 Describe ways to manage network devices: console, Telnet, SSH, HTTP(S), TACACS+/RADIUS, cloud
- 2.9 Interpret the WLC GUI settings that control client connectivity: WLANs, security, QoS, advanced