What is CDP and LLDP?
CDP (Cisco Discovery Protocol) and LLDP (Link-layer Discovery Protocol) are used to discover devices at the layer 2 link only. There is no layer 3 encapsulation of any LLDP/CDP frames. By default, all Cisco devices have CDP enabled and it allows switches, routers, access points etc to learn about the connected devices such as interface details, firmware versions, hostname and make/model number to name a few. CDP is Cisco's proprietary discovery protocol, whereas LLDP is an IEEE 802.1AB standard which is used by all other vendors. Note that LLDP can still be enabled on Cisco equipment.
CDP is typically disabled by organisations as should a malicious user gain access to the network devices, they are able to quickly map the network to discover the topology.
CDP
Information shared between appliances
The following information that can be gathered via CDP includes:
-
Device Type
-
Hardware Platform
-
Hardware Capabilities
-
IOS Version
-
Hostname
-
Interface that generated the CDP message
-
IP Addresses
-
Port IDs
-
CDP Hold Timers
The information shared between Cisco devices can be viewed using the following commands:
-
sh cdp neighbors - This displays a summary of CDP neighbours that are discovered via CDP
-
sh cdp neighbors detail - This displays a detailed output of CDP neighbours that are discovered via CDP
-
sh cdp interface - This displays the CDP timers and hold timers, including interface status
-
sh cdp - This displays a summary CDP global configuration
Let's take a look at some of the outputs from a point-point network between two Cisco routers, nbRTR1 and nbRTR2.
Configuring CDP
CDP is quite simple to configure, as it only operates at layer 2 we do not need to worry about routing etc. The following commands are used to configure CDP. Note you need to be in global configuration mode (conf t).
-
no cdp run - Disables CDP
-
cdp run - Enables CDP
-
cdp timer - Allows amendment of CDP discovery frames transmission (default 60 seconds)
-
cdp holdtime - Allows amendment of the hold timer before a learnt neighbour is removed from the CDP table
​
Because CDP is enabled on all interfaces by default, we can remove interfaces from the global CDP by setting the command 'no cdp enable' within interface config mode (config-if). Such as:
conf t
interface Fa0/1
no cdp enable
exit
exit
Verifying CDP
-
sh cdp neighbors
-
sh cdp neighbors detail
-
sh cdp interface
-
sh cdp
​
​
LLDP
​
Information shared between appliances
Just as with CDP, LLDP allows devices to learn information such as:
-
Hostname
-
Port IDs
-
Port Descriptions
-
System Description
-
System Capabilities
​
Configuring LLDP
​
To configure LLDP on a Cisco network device, use the following commands:
no llp run - Disables LLDP
lldp run - Enables LLDP
lldp timer - Allows amendment of the LLDP transmission timer (default 30 seconds)
lldp holdtime - Allows amendment of the hold timer before a learnt neighbour is removed from the LLDP table
As with CDP, LLDP is enabled on all interfaces by default. To remove an interface from the global LLDP state use the following commands:
conf t
interface Gi0/0
no lldp transmit
no lldp receive
exit
exit
Verifying LLDP
The below commands can be used to verify that LLDP is working.
-
sh lldp
-
sh lldp neighbors
-
sh lldp neighbors detail