Cisco Discovery Protocol

Cisco Discovery Protocol
 


Cisco Discovery Protocol (CDP) is primarily used to obtain protocol addresses of neighboring devices and discover the platform of those devices. CDP can also be used to show information about the interfaces your router uses. CDP is media- and protocol-independent, and runs on all Cisco-manufactured equipment including routers, bridges, access servers, and switches.

Use of SNMP with the CDP Management Information Base (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. Cisco Discovery Protocol uses the CISCO-CDP-MIB.

CDP runs on all media that support Subnetwork Access Protocol (SNAP), including local-area network (LAN), Frame Relay, and Asynchronous Transfer Mode (ATM) physical media. CDP runs over the data link layer only. Therefore, two systems that support different network-layer protocols can learn about each other.

Each device configured for CDP sends periodic messages, known as advertisements, to a multicast address. Each device advertises at least one address at which it can receive SNMP messages. The advertisements also contain time-to-live, or holdtime, information, which indicates the length of time a receiving device should hold CDP information before discarding it. Each device also listens to the periodic CDP messages sent by others in order to learn about neighboring devices and determine when their interfaces to the media go up or down.

CDP Version-2 (CDPv2) is the most recent release of the protocol and provides more intelligent device tracking features. These features include a reporting mechanism which allows for more rapid error tracking, thereby reducing costly downtime. Reported error messages can be sent to the console or to a logging server, and cover instances of unmatching native VLAN IDs (IEEE 802.1Q) on connecting ports, and unmatching port duplex states between connecting devices. See the Cisco IOS Software System Error Messages document for detailed examples of CDP error messages.

CDPv2 show commands can provide detailed output on VLAN Trunking Protocol (VTP) management domain and duplex modes of neighbor devices, CDP-related counters, and VLAN IDs of connecting ports.

VLAN Trunking Protocol (VTP) is a discovery technique deployed by switches where each switch advertises its management domain on its trunk ports, its configuration revision number, and its known VLANs and their specific parameters. A VTP domain is made up of one or more interconnected devices that share the same VTP domain name. A switch can be configured to be in only one VTP domain.

Enable/Disable CDP on a Cisco IOS Device

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

Enable/Disable CDP on an Interface

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.

 

 For Support