Switching
CDP and LLDP
CDP is a Cisco proprietary Layer 2 discovery protocol and LLDP is the IEEE 802.1AB open standard equivalent, both used to learn about directly connected neighbor devices.
What you need to know
- CDP is enabled globally by default on Cisco devices and sends advertisements every 60 seconds with a holdtime of 180 seconds.
- LLDP is disabled by default on most Cisco IOS devices and must be enabled globally with lldp run.
- CDP and LLDP operate at Layer 2 and function across trunk links but not across routed Layer 3 boundaries.
- CDP should be disabled on ports facing untrusted or external networks for security reasons.
- show cdp neighbors detail reveals native VLAN mismatches and IP addressing of directly connected devices.
- LLDP has separate transmit (lldp transmit) and receive (lldp receive) controls per interface.
- Both protocols can be disabled per-interface even when enabled globally, using no cdp enable or no lldp transmit/receive.
Configuration commands
| Command | Mode | Purpose |
|---|---|---|
| cdp run | config | Enable CDP globally (enabled by default). |
| no cdp run | config | Disable CDP globally on the device. |
| no cdp enable | config-if | Disable CDP on a specific interface. |
| cdp timer 30 | config | Change the CDP advertisement interval to 30 seconds. |
| cdp holdtime 90 | config | Change how long a receiver keeps CDP information before aging it out. |
| lldp run | config | Enable LLDP globally. |
| lldp transmit | config-if | Enable LLDP advertisements out this interface. |
| lldp receive | config-if | Enable processing of received LLDP advertisements on this interface. |
Verify it
- show cdp neighbors
- show cdp neighbors detail
- show cdp interface
- show lldp neighbors
- show lldp neighbors detail
- show lldp interface
Common mistakes
- Assuming LLDP is enabled by default like CDP, then finding no neighbors are discovered.
- Leaving CDP enabled on interfaces facing the internet or untrusted third parties.
- Confusing CDP/LLDP neighbor information with actual Layer 3 reachability; discovery does not imply routing works.
- Not realizing a trunk native VLAN mismatch only shows up as a CDP console warning, not a hard failure.
- Disabling CDP globally when only a single interface needed it disabled.
Practise CDP and LLDP in a real CLI
Generated labs, graded against the simulated network state.