Cisco Discovery Protocol (CDP) is a layer-2 Cisco proprietary protocol used to discover basic information about neighbouring, locally connected, Cisco devices. With this, we can gather hardware and protocol information about the neighbours, which can help troubleshooting the devices or simply to document the information about the network. For using CDP, the interfaces must support subnet access protocol (SNAP) headers.
For getting the information, the devices which support CDP broadcast information about themselves, and other devices that support CDP listen to that broadcast and learn the information. With the help of CDP, we can tell about the device id, the local interface (on which the CDP message was received), the capability of the device, the holdtime, the platform and the port ID (the interface through which the CDP message was sent) of the neighbouring device. If the neighbour has no IP address configured on its CDP enabled interface, then the IP address of another interface will be updated as to its IP address.
By default, CDP is enabled globally and on each interface of a Cisco device. To disable CDP globally, we use no cdp run global command, and to re-enable the CDP, globally, we use cdp run global command. We can also disable or re-enable CDP on each interface separately. To disable CDP on a specific interface, we use no cdp enable interface sub-command, and to re-enable CDP on that interface, we use cdp enable interface sub-command. The communication between the interfaces won’t be affected even if we disable the CDP.
We can verify the functionality of CDP by using various show commands. By using the show cdp command, we can ensure whether the CDP is enabled globally and lists the default update and hold timers. We can use the show cdp interface [interface-number] command to see if the CDP is enabled on each interface, or a specific interface if the interface is listed, and also the update and holdtime timers. The use of show cdp traffic helps to see the statistics of the CDP advertisements send and received. To know about the neighbours we can use show cdp neighbors [interface-number] command. This command tells a one-line summary about the neighbours, or a specific neighbour connected to the interface if the interface number is mentioned. To get detailed information about all the neighbours we can use the show cdp neighbors detail command. The use of the show cdp entry name command also lists the same details as the show cdp neighbors command, but only for the specified neighbour.