Network Access · Topic 3 of 9
Layer 2 Discovery with CDP and LLDP
Learn how Cisco Discovery Protocol and LLDP find neighbouring devices, what each protocol shares, their differences, and how to configure and verify them.
- 5 min
- Exam objective 2.3
- CDP is Cisco-only and on by default. LLDP is a standard and usually off by default.
- Both work at Layer 2 and only reach directly connected neighbours.
- CDP timers are 60 seconds and 180 seconds. LLDP timers are 30 seconds and 120 seconds.
What it is
CDP and LLDP let devices announce themselves to the neighbours they are directly connected to.
A network diagram is often out of date. Discovery protocols give you the real picture. From any device, you can see which neighbours it has, what port they are on, and what type of device they are.
There are two protocols to know:
- CDP (Cisco Discovery Protocol): developed by Cisco and used on Cisco devices.
- LLDP (Link Layer Discovery Protocol): an open standard, IEEE 802.1AB, that works between devices from different vendors.
Both work at Layer 2, so they do not need IP addresses to function. They only reach the device on the other end of the cable. They are not forwarded by switches or routers.
How it works
Each device advertises itself on a timer, and each neighbour stores what it hears until the entry expires.
What the protocols share
Each device sends periodic advertisements out of its interfaces. A neighbour reads the information and stores it in a table until the entry expires.
Typical information includes:
- the neighbour's name (hostname)
- the local port and the neighbour's port
- the device type or capability, such as router or switch
- the platform model
- the management IP address
This helps with documenting a network, troubleshooting a link and checking that a cable goes where it should.
CDP
CDP is enabled by default on most Cisco devices. It sends advertisements every 60 seconds and keeps neighbour information for 180 seconds, by default. Frames go to a Cisco multicast address.
show cdp
show cdp neighbors
show cdp neighbors detail
show cdp interface
show cdp neighbors gives a short table with the neighbour's device ID, the local interface, the holdtime, the capability, the platform and the remote port ID. show cdp neighbors detail adds the IP address and software version of each neighbour.
CDP can be turned off on the whole device, or on one interface.
no cdp run
interface GigabitEthernet0/1
no cdp enable
To change the timers:
cdp timer 30
cdp holdtime 120
LLDP
LLDP does a similar job, but it is a standard, so it can be used with phones, servers and other vendors' switches.
On Cisco devices, LLDP is usually not enabled by default and must be turned on. Its default timers are 30 seconds between advertisements and a holdtime of 120 seconds.
lldp run
interface GigabitEthernet0/1
lldp transmit
lldp receive
lldp run turns it on for the device. The interface commands lldp transmit and lldp receive control whether the port sends and listens. By default, both are on, once LLDP is running.
To look at the results:
show lldp
show lldp neighbors
show lldp neighbors detail
An extension called LLDP-MED adds extra information for voice and video devices, such as which VLAN a phone should use.
Side by side
| Feature | CDP | LLDP |
|---|---|---|
| Standard | Cisco proprietary | IEEE 802.1AB, open |
| Works with other vendors | Limited | Yes |
| Default on Cisco devices | Enabled | Usually disabled |
| Default advertisement timer | 60 seconds | 30 seconds |
| Default holdtime | 180 seconds | 120 seconds |
| Show command | show cdp neighbors | show lldp neighbors |
Security note
Discovery protocols reveal useful details to anyone who can listen on a link, such as device models and software versions.
On ports that face users or the outside world, it is good practice to switch them off. Keep them on between your own infrastructure devices, where they are useful.
What to remember for the exam
Eight facts cover most questions on this topic.
- CDP is Cisco-only and on by default. LLDP is a standard and usually off by default.
- Both work at Layer 2 and only reach directly connected neighbours.
- CDP timers are 60 seconds and 180 seconds. LLDP timers are 30 seconds and 120 seconds.
show cdp neighbors detailshows the neighbour's IP address.no cdp rundisables CDP globally.no cdp enabledisables it on one interface.lldp runenables LLDP.lldp transmitandlldp receiveact per interface.- Discovery protocols can leak information, so disable them on untrusted ports.
- Neighbour entries expire when the holdtime runs out.
Pair the numbers by protocol. CDP is 60 and 180, LLDP is 30 and 120, and in both cases the holdtime is the larger of the two.
Common mistakes
These five mistakes come up often.
Expecting to see non-neighbours. These protocols only show devices on directly connected links. A router two hops away is not listed.
Forgetting to enable LLDP. If show lldp neighbors is empty on a Cisco device, check that lldp run is configured.
Mixing vendors and relying on CDP. CDP will not show a non-Cisco neighbour that does not speak it. Use LLDP in mixed networks.
Confusing the two sets of timers. Associate CDP with 60 and 180, and LLDP with 30 and 120.
Leaving CDP on everywhere. On user-facing ports, it exposes information that is not needed.
An empty neighbour table on a Cisco switch usually means LLDP was never turned on, not that the link is broken.
Check yourself
Work through these three prompts.
Why do CDP and LLDP work without IP addresses, and what does that limit them to seeing?
They work at Layer 2, so they need no IP address. They only reach the device on the other end of the cable, because switches and routers do not forward them.
How do CDP and LLDP differ in standard, default state and timers?
CDP is Cisco proprietary, enabled by default, and uses 60-second advertisements with a 180-second holdtime. LLDP is the open IEEE 802.1AB standard, usually disabled by default on Cisco devices, and uses 30 seconds and 120 seconds.
Which command would you use to find the IP address of a directly connected Cisco neighbour?
show cdp neighbors detail, which adds the IP address and software version of each neighbour.
Topic 3 of 9 in Network Access
Test yourself on Network Access
The full Cisco CCNA 200-301 question bank has 1,206 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.