Cisco Discovery Protocol CDP

Jan 2024

Introduction

Cisco Discovery Protocol (CDP) is a Cisco specific protocol for discovering 'Neighbouring' devices (spelt Neighbor in Cisco world). The protocol allows discovery of devices directly connected to the device being interrogated. CDP is a Cisco specific protocol that only works on Cisco devices (Routers, Switches, Phones etc).

Some CDP Facts

CDP is a Layer 2 discovery protocol and so does not use IP Addressing, however CDP can discover the IP Addresses of CDP devices and share them.
CDP shares information with and discovers information about neighbouring devices.
CDP shared information can include host name, IP Address, device type, etc.
Because CDP shares information about the network and devices cdp can be considered by some a security risk and some networks turn it off.
CDP is enabled on Cisco Devices by default.
Only directly connected neighbours can become CDP neighbours.
By default, CDP messages are sent every 60 seconds out of all interfaces that are in an UP state.
When a devices receives a CDP message from a neighbouring device, it adds an entry for that device in its CDP Neighbour table.
When a devices receives a CDP message from a neighboring device, it adds an entry for that device in its CDP Neighbour table.
By default, the CDP Holdtime is 180 seconds, so if a neighbour isn't heard from after 180s, it is removed from the CDP Neighbour table.
CDPv2 messages are sent by default.
LLDP (Link Layer Discovery Protocol) is more of an open standard (IEEE 802.1AB) that competes with CDP.
If you have a mixture of switches, say Cisco, Juniper, Netgear etc you should run LLDP and not use CDP.

Using CDP

CDP is enabled by default on Cisco switches, however it may have been disabled, if you wish to use CDP you can enable it with the following command from CLI:

CDP Run

To see if CDP is running we can use:

cdp run

There will be no output from running this command.

Show CDP

To see how CDP is configured we can use:

sh cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled

Here we can see that CDP is using the default values.

CDP packets are sent every 60 seconds
A holdtime value of 180 seconds is set. If no CDP messages from a device are received for 180 seconds then the
device is removed from the CDP devices table.
CDPv2 is being used.

Show CDP Traffic

To see what traffic we have we can use:

sh cdp traffic
CDP counters :
Total packets output: 2828, Input: 1510
Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
No memory: 0, Invalid packet: 0,
CDP version 1 advertisements output: 0, Input: 0
CDP version 2 advertisements output: 2828, Input: 1510