This document explains how to configure Cisco Discovery Protocol (CDP) on Cisco routers and switches that run Cisco IOSĀ®. Specifically, the document covers how to enable, verify, and disable CDP on Cisco devices and some know issues related to CDP.
CDP is a Cisco proprietary Layer 2 protocol that is media- and protocol-independent, and runs on all Cisco-manufactured equipment that includes:
routers
bridges
access servers
switches
A Cisco device enabled with CDP sends out periodic interface updates to a multicast address in order to make itself known to neighbors. Since it is a layer two protocol, these packets (frames) are not routed. Use of SNMP with the CDP MIB allows network management applications to learn the device type and the SNMP agent address of neighboring devices, and to send SNMP queries to those devices. CDP uses the CISCO-CDP-MIB.
There are no specific requirements for this document.
This document is not restricted to specific software and hardware versions. This document applies to all Cisco routers and switches running Cisco IOS as well as router modules such as WS-X4232-L3, RSM, and MSFC.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.
Refer to Cisco Technical Tips Conventions for more information on document conventions.
CDP is enabled on Cisco routers by default. If you prefer not to use the CDP capability, disable it with the no cdp run command. In order to reenable CDP, use the cdp run command in global configuration mode.
You can verify whether CDP is enabled or disabled on your Cisco device using the show cdp neighbors command.
Router#show cdp neighbors % CDP is not enabled !--- This message indicates that CDP is disabled on this device. Router#
This command output indicates that CDP is enabled on the device, but no neighbor devices are discovered or connected to this device.
Router#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater Device ID Local Intrfce Holdtme Capability Platform Port ID Router# Router#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled Router#
This command output shows that CDP is enabled and some neighbor devices are discovered by CDP protocol.
Router#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater Device ID Local Intrfce Holdtme Capability Platform Port ID R2-AGS Ser 1 129 R 2500 Ser 0 R6-2500 Eth 0 144 R 4000 Eth 0 Router#
The show cdp neighbors command displays this information:
type of device that is discovered
name of the device
number and type of the local interface (port)
number of seconds the CDP advertisement is valid for the port
device type
device product number
port ID
The show cdp neighbors detail and show cdp entry commands displays additional information about the neighboring devices that include network-layer protocol information and version.
router#show cdp neighbors detail ------------------------- Device ID: lab-7206 Entry address(es): IP address: 172.19.169.83 Platform: cisco 7206VXR, Capabilities: Router Interface: Ethernet0, Port ID (outgoing port): FastEthernet0/0/0 Holdtime : 123 sec Version : Cisco Internetwork Operating System Software IOS (tm) 5800 Software (C5800-P4-M), Version 12.1(2) Copyright (c) 1986-2002 by Cisco Systems, Inc. advertisement version: 2 Duplex: half ------------------------- Device ID: lab-as5300-1 Entry address(es): IP address: 172.19.169.87 Platform: cisco AS5300, Capabilities: Router --More-- !--- Output is suppressed.
router#show cdp entry lab-7206 ------------------------- Device ID: lab-7206 Entry address(es): IP address: 172.19.169.83 Platform: cisco 7206VXR, Capabilities: Router Interface: Ethernet0, Port ID (outgoing port): FastEthernet0/0/0 Holdtime : 123 sec Version : Cisco Internetwork Operating System Software IOS (tm) 5800 Software (C5800-P4-M), Version 12.1(2) Copyright (c) 1986-2002 by Cisco Systems, Inc. advertisement version: 2 Duplex: half
When CDP is enabled globally using the cdp run command, it is enabled by default on all supported interfaces (except for Frame Relay multipoint subinterfaces) to send and receive CDP information. You can disable CDP on an interface that supports CDP with the no cdp enable command.
Router#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater Device ID Local Intrfce Holdtme Capability Platform Port ID R2-AGS Ser 1 129 R 2500 Ser 0 R6-2500 Eth 0 144 R 4000 Eth 0 Router#
On this router, CDP is enabled on Serial 1 and Ethernet 0 interfaces. Disable CDP on the Serial 1 interface and verify if the neighbor device is discovered on the serial 1 interface, as this output shows:
Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface s1 Router(config-if)#no cdp enable Router(config-if)#^Z Router#4w5d: %SYS-5-CONFIG_I: Configured from console by console
The router does not remove the entry for the neighbor on CDP disabled interface unless the hold time expires. This output shows that the router discovered neighbor only on Ethernet 0 interface.
Router#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater Device ID Local Intrfce Holdtme Capability Platform Port ID R6-2500 Eth 0 149 R 4000 Eth 0 Router#
Use the show running-config command in order to find whether CDP is enabled/disabled on a particular interface on your device.
Router#show running-config int s1 Building configuration... Current configuration : 94 bytes ! interface Serial1 ip address 40.40.40.1 255.255.255.0 ip router isis no cdp enable !--- This command indicates that CDP is disabled on the Serial 1 interface. end Router#
Note: You cannot enable/disable CDP on an interface unless it is enabled globally using the cdp run command.
When a large amount of CDP neighbor announcements are sent, it is possible to consume all memory of an available device. This causes a crash or other abnormal behavior. Refer to Cisco's Response to the CDP Issue for more details: