CDP and LLDP

Before tracing a cable under the floor, ask the switch who is on the other end. CDP is one vendor's Layer 2 discovery protocol; LLDP, IEEE 802.1AB, lets devices from different makers discover each other. A device that never speaks CDP may answer on LLDP, which is disabled until lldp run. Every field in a neighbour entry is the neighbour's own account of itself.

In Daveth Pro (Network)5 min video · lab: Campus, hardened

By , founder of Daveth · Updated

Opening frame of the video walkthrough of CDP and LLDP

Watch this lesson

5 min · Video walkthrough

In Daveth Pro (Network)

The full 5 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab C1: Campus, hardened

What the lab covers

What this page answers

What is the difference between CDP and LLDP?

CDP is one vendor's Layer 2 discovery protocol, independent of media and network layer. LLDP is the IEEE standard for the same job, 802.1AB, so devices from different makers can discover one another. Read it in “Which protocol, and which one is running”

Why does show lldp neighbors show nothing?

LLDP may be disabled, globally and on every interface in both directions. lldp run enables it, and lldp transmit and lldp receive are separate permissions per interface. Read it in “Which protocol, and which one is running”

What does a CDP or LLDP neighbour entry prove?

That a device on that port announced this identity, platform and port recently enough that the holdtime has not run out. Every field is the neighbour's own account; none is measured by your switch. Read it in “What an entry is worth”

What is plugged into Gi1/0/12?

The documentation says the port is spare. The port is up. Before you trace a cable under a floor tile, ask the switch who is on the other end.

Computed from the state: ACC-1's CDP table at the start. Laid out in this course's own columns.

ACC-1# show cdp neighbors
Device ID        Local Intrfce  Holdtme Capability Platform        Port ID
DIST-1           Gi1/0/48       160     R S I      SW-24X4         Te1/0/3
ACC-2            Gi1/0/20       160     S I        SW-24P          Gi1/0/24
ACC-2            Gi1/0/21       160     S I        SW-24P          Gi1/0/24
SEP00AB12CD34EF  Gi1/0/7        160     H P        IP Phone        Port 1

The device names and software versions in these tables are this course's own, so nothing here ties the lesson to one maker's catalogue. On your own switch the column will read whatever your kit is called: the point is that it reads something, to anyone listening.

Four entries, and none on Gi1/0/12. That is not the same as nothing being there. A neighbour command lists what the switch was told: the device type, the interface type and number, the holdtime, the capabilities and the port ID, one row for every device that announced itself and was heard.

Which protocol, and which one is running

There are two discovery protocols on this switch, and they are not the same protocol. CDP is one vendor's: a Layer 2 protocol, independent of the media and of the network layer above it, that lets a device learn about the devices directly connected to it. LLDP is the IEEE's standard for the same job, 802.1AB, and a switch supports it so that devices from different makers can discover one another at all.

So whatever is on Gi1/0/12 might not speak CDP. Ask LLDP, then, and get nothing at all, not even DIST-1, which is plainly there.

Read the two sets of defaults side by side. CDP is enabled when the switch comes out of the box, globally and on every supported interface, both sending and receiving. LLDP is disabled: globally, and on every interface in both directions.

One is on and one is off, out of the box. An empty LLDP table is evidence about your switch, not about the far end. Turning it on is two jobs: globally, and then on each interface that should use it, here the server's port and the uplink.

Configuration: LLDP on, and on Gi1/0/12 and the uplink.

ACC-1# configure terminal
ACC-1(config)# lldp run
ACC-1(config)# interface GigabitEthernet1/0/12
ACC-1(config-if)# lldp transmit
ACC-1(config-if)# lldp receive
ACC-1(config-if)# interface GigabitEthernet1/0/48
ACC-1(config-if)# lldp transmit
ACC-1(config-if)# lldp receive
ACC-1(config-if)# end

Three commands, three separate permissions: one enables LLDP on the device, one lets the interface send, and one lets it receive. An interface that transmits but does not receive is a perfectly legal and perfectly useless half of a conversation.

Now the first question again, asked of the other protocol: is anything on Gi1/0/12 announcing itself over LLDP?

Computed from the state: ACC-1's LLDP table after it is enabled on Gi1/0/12 and the uplink. This course's layout: the columns are the device, the local port, the holdtime and the port ID.

ACC-1# show lldp neighbors
Device ID        Local Intrfce  Holdtme Port ID
DIST-1           Gi1/0/48       100     Te1/0/3
srv-backup-02    Gi1/0/12       100     eno1

There it is: srv-backup-02, a Linux server that never spoke CDP. DIST-1 is in both tables now, once per protocol. One small trap on the way back: CDP being on is the default, and a default is not written down. Running show run may not display that CDP is enabled at all: the absence of a line is not the absence of the protocol.

What an entry is worth

A discovery protocol is how a device advertises information about itself to the other devices on the network: configuration details, what it is capable of, and who it says it is.

About themselves. Every field in a neighbour entry is the neighbour's own account: the device ID is the name the neighbour gave, or its MAC address or serial number; the port ID is the interface and port number at the far end, as the far end reports it. Not one of those fields is measured by the switch you are typing on.

Now look at Gi1/0/20 and Gi1/0/21. Both entries say ACC-2, platform SW-24P, port Gi1/0/24.

Only that something on each port announced itself as ACC-2. Here they are two switches: the one on Gi1/0/21 was staged from ACC-2's configuration, hostname included. ACC-1 lists ACC-2 twice and is not wrong to: it reports what it was told. Anything that keys devices by that name, a topology map or a script, would count one switch with two links.

Every device on this page is exactly who it says it is, which is the trouble: two of them say they are ACC-2.

So the answer comes from something that is not an announcement: the serial number on the chassis, the MAC address table, or walking to the cabinet.

Proves: that a device on that port announced this identity, platform and port, recently enough that the holdtime has not run out. Does not prove: that the announcement is true, that it came from the device you think, or that the device is still sending.