Switching and Network Access · Topic 4 of 6
CDP and LLDP for Network Documentation
Use CDP and LLDP neighbor output to check a network diagram, spot wrong ports, missing neighbors and stale documentation, and learn the default timers.
- 5 min
- CDP is Cisco only and on by default. LLDP is open, IEEE 802.1AB, and usually off by default.
- Both work at Layer 2 and show only directly connected neighbors.
- CDP timers are 60 and 180 seconds. LLDP timers are 30 and 120 seconds.
What it is
CDP and LLDP let each device announce itself to its directly connected neighbors, so you can compare the real network with the diagram.
Diagrams go out of date. A cable is moved, a switch is replaced, a port is renumbered, and the drawing stays the same. Neighbor output shows what is really plugged into each port.
CDP (Cisco Discovery Protocol) is Cisco proprietary. LLDP (Link Layer Discovery Protocol) is the open standard, IEEE 802.1AB, and works across vendors. Both run at Layer 2, need no IP address, and only reach the device at the other end of the cable. Switches and routers do not forward them.
How it works
Each device sends advertisements on a timer, and each neighbor keeps what it hears until the entry expires.
CDP
CDP is enabled by default on Cisco devices. It sends advertisements every 60 seconds and keeps entries for 180 seconds.
SW1# show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
R1 Gig 0/1 150 R B ISR4331 Gig 0/0/1
SW2 Gig 0/2 160 S I WS-C3560 Gig 0/2
Each row is one neighbor. Read it as: my port Gig 0/1 connects to port Gig 0/0/1 on R1, which is a router.
SW1# show cdp neighbors detail
Device ID: R1
Entry address(es):
IP address: 10.1.1.1
Platform: cisco ISR4331, Capabilities: Router Source-Route-Bridge
Interface: GigabitEthernet0/1, Port ID (outgoing port): GigabitEthernet0/0/1
Holdtime : 150 sec
detail adds the management IP address and the software version. Turn CDP off globally with no cdp run, or on one port with no cdp enable.
LLDP
LLDP is usually off by default on Cisco devices, so turn it on first. Its defaults are an advertisement every 30 seconds and a holdtime of 120 seconds.
lldp run
interface GigabitEthernet0/1
lldp transmit
lldp receive
SW1# show lldp neighbors
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
Device ID Local Intf Hold-time Capability Port ID
R1 Gi0/1 120 R Gi0/0/1
Total entries displayed: 1
show lldp neighbors detail adds the chassis ID, system name, system description and management address. Because LLDP is a standard, use it for phones, servers and other vendors' switches.
| Feature | CDP | LLDP |
|---|---|---|
| Standard | Cisco proprietary | IEEE 802.1AB |
| Default on Cisco devices | Enabled | Usually disabled |
| Advertisement timer | 60 seconds | 30 seconds |
| Holdtime | 180 seconds | 120 seconds |
| Show command | show cdp neighbors | show lldp neighbors |
Validating a diagram
Work through each device and compare four things with the drawing: the neighbor name, the local port, the remote port and the management IP address.
Suppose the diagram says SW1 Gig 0/2 connects to SW2 Gig 0/1. The output above says SW2 Gig 0/2. The cable is in the wrong port, or the diagram is wrong. Either way the documentation and the network disagree.
These findings mean the documentation is not accurate:
- A neighbor on the diagram is missing from the output. Check the cable, the port state and whether CDP or LLDP is running on both ends.
- A neighbor appears on a port that the diagram shows as empty.
- The platform or IP address differs from the record, so a device was replaced or readdressed.
- The local port is right but the remote port differs.
Neighbor tables also expose faults. CDP can log %CDP-4-NATIVE_VLAN_MISMATCH and %CDP-4-DUPLEX_MISMATCH when the two ends disagree.
Walk the network one hop at a time. A neighbor table only shows the next device, so log in to that device to see the one after it.
Common mistakes
Expecting devices two hops away. Neighbor output covers only directly connected devices.
Forgetting lldp run. An empty show lldp neighbors on a Cisco device usually means LLDP was never turned on.
Relying on CDP in a mixed network. A non-Cisco device that does not speak CDP will not appear. Use LLDP.
Mixing up the timers. CDP is 60 and 180. LLDP is 30 and 120. The holdtime is the larger number in both.
Trusting the diagram over the output. The neighbor table is live, and the diagram is a record that may be old.
Discovery protocols reveal models and software versions. Turn them off on ports that face users or outside networks.
What to remember for the exam
- CDP is Cisco only and on by default. LLDP is open, IEEE 802.1AB, and usually off by default.
- Both work at Layer 2 and show only directly connected neighbors.
- CDP timers are 60 and 180 seconds. LLDP timers are 30 and 120 seconds.
show cdp neighbors detailshows the neighbor IP address and software version.no cdp runturns CDP off globally.no cdp enableturns it off on one interface.lldp runturns LLDP on.lldp transmitandlldp receiveact per interface.- To validate a diagram, compare neighbor name, local port, remote port and IP address.
- A missing or different neighbor means the cabling or the documentation is wrong.
Check yourself
Which four details do you compare to validate a diagram against neighbor output?
The neighbor name, the local port, the remote port and the management IP address.
A router on the diagram is missing from show lldp neighbors on a Cisco switch. What do you check first?
Check that lldp run is configured on both devices and that the link is up, because LLDP is usually off by default.
Why can CDP not show a router that is two hops away?
CDP is a Layer 2 protocol, and switches and routers do not forward its advertisements, so it only reaches the device at the other end of the cable.
Topic 4 of 6 in Switching and Network Access
Test yourself on Switching and Network Access
The full Cisco CCNA 200-301 v2.0 question bank has 1,242 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.