CDP and LLDP
| CDP | LLDP | |
|---|---|---|
| Defined by | Cisco (proprietary) | IEEE 802.1AB (standard) |
| In IOS | On by default | Off: lldp run |
| Advertisement and holdtime | 60 s and 180 s | 30 s and 120 s |
| Frame | 802.3 + LLC/SNAP to 01:00:0c:cc:cc:cc | Ethernet II 0x88cc to 01:80:c2:00:00:0e |
| IP phones | Voice VLAN over CDP | Voice VLAN over LLDP-MED |
Both are Layer 2 and only reach the direct neighbor: they cross neither routers nor switches. That is why they tell you what is on the other end of each cable.
How to validate the documentation
| Command | What you check |
|---|---|
show cdp neighbors | Which device is on each port, and on which of its ports |
show cdp neighbors detail | Addresses, platform, version, native VLAN and duplex |
show lldp neighbors | The same with non-Cisco devices |
show interfaces status | The descriptions (the inventory) versus what is connected |
show cdp entry * | The detail of every neighbor |
If the inventory and the neighbors do not match, reality wins: fix the documentation (or the cabling) and check again.
How it works: from the advertisement to the inventory
Six steps: a neighbor that matches, a trunk with a native VLAN mismatch, an AP on another port, the voice VLAN, LLDP and the WAN.
SW1 and R1: the neighbor matches
SW1 sends a CDP advertisement out Gi1/0/24 and R1 another out Gi0/0/1. They go to the multicast address 01:00:0c:cc:cc:cc, in 802.3 frames with LLC/SNAP, and the neighbor does not forward them: CDP only reaches the device on the other end of the cable. Each advertisement is a list of TLVs (type, length and value): the name (Device ID), the addresses, the outgoing port (Port ID), the capabilities, the version and the platform. show cdp neighbors detail on SW1 confirms what the port description says: R1, an ISR 4331, on its Gi0/0/1.
Trunk to SW2: native VLAN mismatch
The inventory says trunk Gi1/0/48 uses native VLAN 99 on both switches, as in the Ethernet and 802.1Q lab. SW1's advertisement carries Native VLAN 99, but SW2's arrives with 1: someone left SW2's port at the default. SW1 detects it and logs %CDP-4-NATIVE_VLAN_MISMATCH. It is not a detail: untagged traffic from VLAN 99 on one side lands in VLAN 1 on the other, and the two VLANs get merged. The fix: switchport trunk native vlan 99 on SW2.
The AP: another port
An advertisement from AP-VAN-01, a Catalyst 9120, arrives on Gi1/0/14. According to the documentation, the AP was on Gi1/0/12, which now shows notconnect: someone moved it and did not update the inventory. show cdp neighbors makes it clear in a table: the device, the local port, the remaining holdtime, the capabilities, the platform and the remote port. The descriptions are corrected and the port left free is shut down.
The IP phone: the voice VLAN over CDP
Gi1/0/5 has an IP phone with Ana's PC behind it: switchport access vlan 10 for data and switchport voice vlan 110 for voice. SW1's CDP advertisement on that port includes the VoIP VLAN Reply TLV with VLAN 110. The phone learns it and sends its voice traffic tagged in VLAN 110, while the PC stays untagged in VLAN 10. This is CCNA v2.0 topic 2.2.c. With phones from other vendors, the same is done with LLDP-MED.
LLDP: the printer that does not speak CDP
The PRN-VAN-01 printer does not show up in show cdp neighbors: CDP is Cisco's and the printer only speaks LLDP, the IEEE 802.1AB standard. In IOS, LLDP is off by default; with lldp run, SW1 starts sending and processing LLDP advertisements (EtherType 0x88cc, to 01:80:c2:00:00:0e). The mandatory TLVs are Chassis ID, Port ID, TTL and End; the rest (name, description, capabilities, management address) are optional. show lldp neighbors confirms the printer on Gi1/0/10, as the inventory says.
The WAN: CDP says too much
CDP is active on every interface of R1, including Gi0/0/0, the one facing the provider. Every 60 seconds, R1 sends it its name, its model, its public IP and the exact IOS XE version: just what an attacker needs to look for vulnerabilities. The rule: CDP and LLDP only where they are needed, never toward networks you do not control. On R1, no cdp enable on Gi0/0/0; show cdp interface no longer lists it.
Warnings CDP gives
| Message | What it means |
|---|---|
| %CDP-4-NATIVE_VLAN_MISMATCH | The two ends of a trunk have different native VLANs |
| %CDP-4-DUPLEX_MISMATCH | One end is full duplex and the other half duplex |
Both are common configuration mistakes that, without CDP, only show up as intermittent failures.
CDP, LLDP and security
| Command | Where |
|---|---|
no cdp enable | On interfaces toward the provider, the Internet or third-party networks |
no lldp transmit and no lldp receive | On interfaces where LLDP is not needed |
no cdp run | On the whole device, if you do not need it |
A CDP or LLDP advertisement gives anyone connected to the port the device's name, model, addresses and version. There are also attacks that send fake advertisements to fill the neighbor table. Enable them only toward your own devices.
Frequently asked questions
Do CDP or LLDP go through a switch?
No. The destination addresses are multicasts the switch processes and does not forward. Each device only sees its direct neighbor, on the other end of the cable.
Why does the printer not show up in show cdp neighbors?
Because CDP is Cisco's and most devices from other vendors only speak LLDP. To see them, enable LLDP with lldp run.
What happens if the native VLAN does not match?
Untagged traffic from one side lands in another VLAN on the other, and two VLANs get merged without anyone meaning to. CDP detects and logs it; the fix is to set the same native VLAN on both ends.
How does the IP phone know its voice VLAN?
Through CDP, in the VoIP VLAN Reply TLV the switch sends, or through LLDP-MED (Network Policy TLV) with phones from other vendors. It can also get it over DHCP or be configured by hand.
How long does a disconnected neighbor take to disappear?
As long as its holdtime: up to 180 s for CDP and 120 s for LLDP, with the default values.
What you take away
- CDP (Cisco) and LLDP (IEEE 802.1AB) tell each device's direct neighbor who it is.
- CDP: on by default in IOS, every 60 s, kept 180 s. LLDP: lldp run, every 30 s, 120 s.
- show cdp neighbors and show lldp neighbors validate the inventory port by port.
- CDP warns when the native VLAN or duplex does not match on a link.
- The switch gives the phone its voice VLAN over CDP or LLDP-MED.
- Turn them off toward networks you do not control: they reveal the model and version.
NEXT STEP
From this lesson to the CCNA 2.0 Course
Switch connectivity and network documentation (topics 2.1 to 2.3) are part of The House of Routing's CCNA 2.0 Course, with the Canadá Logística lab. We will let you know when it opens.
Upcoming protocol lessons
Sources
- Cisco · IOS XE 17 configuration guides (Catalyst 9300 System Management: CDP, LLDP and LLDP-MED)
- Wireshark · Display Filter Reference: Cisco Discovery Protocol
- Wireshark · Display Filter Reference: Link Layer Discovery Protocol (IEEE 802.1AB)
- Cisco · 200-301 CCNA v2.0 Exam Topics (2.2.c, 2.3)
Lesson prepared with AI assistance and checked against the sources cited. The bytes of every packet are generated according to the standard and verified with an independent tool.