Layer 2 Discovery Protocols (CDP & LLDP)
Overview
- Concept: Layer 2 discovery protocols allow directly connected devices to share information about themselves and discover their neighbors.
- Details:
- Operate strictly at Layer 2 (Data Link Layer). They do not use IP addresses for communication; frames contain no IP packets.
- Can share Layer 3 information (e.g., IP addresses, hostnames, device types, software versions).
- Security Risk: Because they broadcast device information, they are often disabled in production networks.
- Protocols:
- CDP (Cisco Discovery Protocol): Cisco proprietary.
- LLDP (Link Layer Discovery Protocol): IEEE 802.1AB industry standard (multi-vendor).
graph LR
R1[Router 1] -- CDP/LLDP Multicast Frames --> SW1[Switch 1]
SW1 -- CDP/LLDP Multicast Frames --> R1
Cisco Discovery Protocol (CDP)
CDP Details & Timers
- Concept: A Cisco proprietary protocol used to exchange information with directly connected Cisco devices.
- Details:
- Default State: Enabled globally and on all interfaces by default.
- Multicast MAC:
0100.0CCC.CCCC(Shared with VTP, DTP, PagP, UDLD). - Scope: Only directly connected neighbors (frames are processed and discarded, not forwarded).
- Version: CDPv2 is enabled by default (identifies native VLAN mismatches).
- Timers:
- Update Timer: 60 seconds (how often messages are sent).
- Holdtime: 180 seconds (time before a neighbor is removed if no messages are received).
Things to note: The CDP multicast MAC address 0100.0CCC.CCCC is a common exam topic. Remember it is shared with VTP, DTP, PagP, and UDLD. Switches without an IP address (no SVI) will not display an IP address in the CDP output.
CDP Verification Commands
R1# show cdp
! Shows global status: timers (60s/180s) and CDP version (v2).
R1# show cdp traffic
! Shows packet counters: number of CDP advertisements sent and received.
R1# show cdp interface [interface]
! Shows interface-specific info: encapsulation (ARPA/Ethernet 2), timers, and interface status.
R1# show cdp neighbors
Output columns for show cdp neighbors:
- Device ID: Hostname of the neighbor.
- Local Interface: Interface on the local device connected to the neighbor.
- Holdtime: Counts down from 180s. Resets when a new message is received.
- Capability: Device type codes: R (Router), S (Switch), I (IGMP), B (Source Route Bridge). Focus on R and S for the CCNA.
- Platform: Hardware model (e.g., C2900, C2960).
- Port ID: Interface on the neighboring device.
R1# show cdp neighbors detail
! Shows extended info: IP address, IOS version, VTP management domain, Native VLAN, Duplex settings.
! Note: VTP info is only available via CDP because VTP is Cisco proprietary.
R1# show cdp entry <hostname>
! Shows the exact same detailed output as 'show cdp neighbors detail', but for a single specific neighbor.
CDP Configuration Commands
R1(config)# cdp run
! Enables CDP globally (Default state). Use 'no cdp run' to disable.
R1(config-if)# cdp enable
! Enables CDP on a specific interface for both Tx and Rx (Default state). Use 'no cdp enable' to disable.
R1(config)# cdp timer <seconds>
! Changes the CDP update timer (Default: 60).
R1(config)# cdp holdtime <seconds>
! Changes the CDP holdtime (Default: 180).
R1(config)# cdp advertise-v1
! Disables CDPv2 and enables CDPv1. (CDPv2 is default).
Link Layer Discovery Protocol (LLDP)
LLDP Details & Timers
- Concept: An industry-standard protocol (IEEE 802.1AB) used in multi-vendor environments.
- Details:
- Default State: Disabled globally and on all interfaces by default on Cisco devices.
- Multicast MAC:
0180.C200.000E. - Scope: Only directly connected neighbors.
- Timers:
- Update Timer: 30 seconds (Default).
- Holdtime: 120 seconds (Default).
- Reinitialization Delay: 2 seconds (Default). Delays initialization to prevent flapping when LLDP is rapidly enabled/disabled.
Things to note: Unlike CDP, LLDP requires separate commands to enable Transmit (Tx) and Receive (Rx) on interfaces.
LLDP Verification Commands
R1# show lldp
! Shows global status: LLDP enabled, timers (30s update, 120s holdtime, 2s reinit).
R1# show lldp traffic
! Shows frame counters: number of LLDP frames sent and received.
R1# show lldp interface [interface]
! Shows Tx/Rx enabled status and current states (e.g., Tx IDLE, Rx WAIT FOR FRAME).
R1# show lldp neighbors
Output columns for show lldp neighbors:
- Device ID: Hostname of the neighbor.
- Local Interface: Interface on the local device.
- Holdtime: Displays the static configured value (120s). It does NOT count down in this view.
- Capability: Device type codes: B (Bridge/Switch), R (Router). Note: ‘S’ is not used for switches in LLDP.
- Port ID: Interface on the neighboring device.
R1# show lldp neighbors detail
! Shows extended info: OS version, Time remaining (counts down).
! Capability fields:
! - System Capabilities: What the device supports (e.g., B, R).
! - Enabled Capabilities: What is currently active (e.g., if 'ip routing' is on, 'R' appears here).
! Note: Does NOT show VTP information.
R1# show lldp entry <hostname>
! Shows detailed output for a single specific neighbor.
LLDP Configuration Commands
R1(config)# lldp run
! Enables LLDP globally. (Must be done first).
R1(config-if)# lldp transmit
! Enables the interface to SEND LLDP messages.
R1(config-if)# lldp receive
! Enables the interface to RECEIVE LLDP messages.
R1(config)# lldp timer <seconds>
! Changes the LLDP update timer (Default: 30).
R1(config)# lldp holdtime <seconds>
! Changes the LLDP holdtime (Default: 120).
R1(config)# lldp reinit <seconds>
! Changes the LLDP reinitialization delay timer (Default: 2).
CDP vs LLDP Comparison
| Feature | CDP (Cisco Discovery Protocol) | LLDP (Link Layer Discovery Protocol) |
|---|---|---|
| Standard | Cisco Proprietary | IEEE 802.1AB (Industry Standard) |
| Default State | Enabled (Global & Interfaces) | Disabled (Global & Interfaces) |
| Multicast MAC | 0100.0CCC.CCCC |
0180.C200.000E |
| Update Timer | 60 seconds | 30 seconds |
| Holdtime | 180 seconds | 120 seconds |
| Interface Config | cdp enable (Tx & Rx together) |
lldp transmit & lldp receive (Separate) |
| Switch Capability Code | S (Switch) | B (Bridge) |
| VTP Info Shared | Yes | No |
| Holdtime Display | Counts down in show ... neighbors |
Static in show ... neighbors, counts down in detail |
Wireshark Frame Analysis
- CDP Frame:
- Destination MAC:
0100.0CCC.CCCC(Identified by Wireshark as CDP/VTP/DTP/PagP/UDLD). - TTL (Time to Live) field represents the CDP Holdtime (180s).
- Contains no IP packet inside the Ethernet frame.
- Destination MAC:
- LLDP Frame:
- Destination MAC:
0180.C200.000E. - TTL field represents the LLDP Holdtime (120s).
- Contains System Name, Capabilities (Bridge, Router).
- Destination MAC:
Common Misconceptions & Exam Tips
- Misconception: LLDP uses ‘S’ for Switch. Correction: LLDP uses ‘B’ for Bridge. ‘S’ is only used in CDP.
- Misconception:
show cdp neighborsdisplays the neighbor’s IP address. Correction: You must useshow cdp neighbors detailto see the IP address and IOS version. - Misconception: LLDP and CDP frames are routed. Correction: They are Layer 2 frames and are strictly limited to directly connected neighbors.
- Exam Tip: If a question asks what command shows the configured CDP timers, both
show cdpandshow cdp interfaceare correct.show cdp neighborsonly shows the current countdown holdtime.
Summary of Commands
CDP Commands
! Verification
show cdp
show cdp traffic
show cdp interface
show cdp neighbors
show cdp neighbors detail
show cdp entry <hostname>
! Configuration
cdp run
no cdp run
cdp enable
no cdp enable
cdp timer <seconds>
cdp holdtime <seconds>
cdp advertise-v1
LLDP Commands
! Verification
show lldp
show lldp traffic
show lldp interface
show lldp neighbors
show lldp neighbors detail
show lldp entry <hostname>
! Configuration
lldp run
no lldp run
lldp transmit
no lldp transmit
lldp receive
no lldp receive
lldp timer <seconds>
lldp holdtime <seconds>
lldp reinit <seconds>