Cisco Discovery Protocol

Cisco Discovery Protocol (CDP) is a media and protocol-independent protocol that runs on all Cisco-manufactured equipment including routers, bridges, access and communication servers, and switches. Using CDP, you can view information about all the Cisco devices that are directly attached to the device.

CDP Overview

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

CDP runs on all media that support the Subnetwork Access Protocol (SNAP), including LAN, Frame Relay, and 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 hold-time, information, which indicates the length of time a receiving device holds CDP information before discarding it. Each device also listens to the periodic CDP messages sent by others to learn about neighboring devices and determine when their interfaces to the media go up or down.

CDPv2

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 for more rapid error tracking, ultimately reducing costly downtime. The console or a logging server receives the reported error messages. These messages can cover instances of unmatching native VLAN IDs (IEEE 802.1Q) on connecting ports, and unmatching port duplex states between connecting devices.

By default, when CDP is enabled, the router sends CDPv2 packets. CDP also sends and receives CDPv1 packets if the device with which CDP is interacting doesn’t process CDPv2 packets.

MIB: CISCO-CDP-MIB

The CDP MIB facilitates these benefits:

  • Permit network management applications to learn the device type.

  • Enable network management applications to ascertain the SNMP agent address of neighboring devices.

  • Send SNMP queries to these devices.

TLV Definitions for CDPv2 Advertisements

Type-length-valuefields (TLVs) are blocks of information embedded in CDP advertisements. This table summarizes the TLV definitions for CDP advertisements.

Table 1. Definitions of TLV
TLV Definition

Device-IDTLV

Identifies the device name in the form of a character string.

AddressTLV

Contains a list of network addresses of both receiving and sending devices.

Port-IDTLV

Identifies the port on which the CDP packet is sent.

CapabilitiesTLV

Describes the functional capability for the device in the form of a device type; for example, a switch.

Version TLV

Contains information about the software release version on which the device is running.

PlatformTLV

Describes the hardware platform name of the device, for example, Cisco 4500.

VTPManagement Domain TLV

Advertises the system’s configured VTP management domain name-string.Used by network operators to verify VTP domain configuration in adjacent network nodes.

NativeVLAN TLV

Indicates,per interface, the assumed VLAN for untagged packets on the interface. CDP learns the native VLAN for an interface. This feature is implemented only for interfaces that support the IEEE 802.1Q protocol.

Full/HalfDuplex TLV

Indicates status (duplex configuration) of CDP broadcast interface. Used by network operators to diagnose connectivity problems between adjacent network elements.

Enable CDP

Perform the following steps to enable CDP.

Procedure


Step 1

Check if CDP is installed on your router by using show install active summary. show install active summary. CDP is an optional package.

Router#show install active summary
Label : 7.3.1.28I
Active Packages: 1
asr9k-xr-7.3.1.28I version=7.3.1.28I [Boot image]

Step 2

Enable CDP on a router using the cdp command. You must first enable CDP globally on the router and then enable CDP on a per-interface basis.

Router#configure
Router(config)#cdp 
Router(config)#int TenGigE 0/5/0/11/1
Router(config-if)#cdp
Router (config-if)#commit

Step 3

Modify the default attributes of CDP such as default version, hold-time setting, and timer settings.

Router#configure
Router(config)#cdp advertise v1
Router(config)#cdp holdtime 30
Router(config)#cdp timer 20
Router(config)#commit

Monitor CDP

Monitoring CDP is crucial for network administrators to maintain an accurate network topology, ensure device inventory accuracy, troubleshoot network connectivity issues, enhance network security, and optimize network performance. You can monitor CDP with the following tasks:

View Neighbours Discovered Through CDP

You can display information about a specific neighboring device or all neighboring devices discovered using show cdp entry command.

Procedure


In this example, the optional entry argument is used to display entry information related to a specific CDP neighbor.

Router#show cdp entry asr9k-rtr1
-------------------------
Device ID: asr9k-rtr1
SysName : asr9k-rtr1
Entry address(es): 
IPv4 address: 192.0.2.1
Platform: cisco ASR9K Series, Capabilities: Router 
Interface: TenGigE 0/5/0/11/3
Port ID (outgoing port): TenGigE 0/1/0/11
Holdtime : 173 sec

Version :
Cisco IOS XR Software, Version 5.3.1.10I[Default]
Copyright (c) 2015 by Cisco Systems, Inc.

advertisement version: 2
Duplex: full

-------------------------
Device ID: asr9k-rtr1
SysName : asr9k-rtr1
Entry address(es): 
IPv4 address: 192.0.2.1
Platform: cisco ASR9K Series, Capabilities: Router 
Interface: TenGigE 0/5/0/11/2
Port ID (outgoing port): TenGigE 0/1/0/10
Holdtime : 169 sec

Version : 
Cisco IOS XR Software, Version 5.3.1.10I[Default]
Copyright (c) 2015 by Cisco Systems, Inc.

advertisement version: 2
Duplex: full

-------------------------
Device ID: asr9k-rtr1
SysName : asr9k-rtr1
Entry address(es): 
IPv4 address: 192.0.2.1
Platform: cisco ASR9K Series, Capabilities: Router 
Interface: TenGigE 0/5/0/11/1
Port ID (outgoing port): TenGigE 0/1/0/10
Holdtime : 165 sec

Version :
Cisco IOS XR Software, Version 5.3.1.10I[Default]
Copyright (c) 2015 by Cisco Systems, Inc.

advertisement version: 2
Duplex: full

Learn Interface Enabled with CDP

You can display information about the interface on which CDP is enabled using the show cdp interface command.

Procedure


In this example, CDP information related to Packet over SONET/SDH (POS) interface 0/5/0/11/1 is displayed.

Router#show cdp interface TenGigE 0/5/0/11/1
  
  TenGigE 0/5/0/11/1 is Up
    Encapsulation ether
				Sending CDP packets every 20 seconds
				Holdtime is 30 seconds

Display Information About Neighbours Using CDP

You can display detailed information about neighboring devices discovered using CDP.

Procedure


Step 1

In the following example, you can see the detailed information displayed about neighboring devices using CDP.

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
  asr9k-rtr1 						Te0/5/0/11/1 			152 					R 										ASR9K Ser Te0/1/0/9 
		asr9k-rtr1 						Te0/5/0/11/2 			156 					R 										ASR9K Ser Te0/1/0/10 
		asr9k-rtr1 						Te0/5/0/11/3 			160 					R 										ASR9K Ser Te0/1/0/11 

Step 2

The following is sample output for the show cdp neighbors command. In this example, the optional type instance arguments are used in conjunction with the detail optional keyword to display detailed information about a CDP neighbor. The output includes information on both IPv4 and IPv6 addresses.

Router#show cdp neighbors TenGigE 0/5/0/11/1 detail
Device ID: asr9k-rtr1 SysName : asr9k-rtr1 Entry address(es): 

IPv4 address: 192.0.2.1 

Platform: cisco ASR9K Series, Capabilities: Router Interface: TenGigE 0/5/0/11/1 

Port ID (outgoing port): TenGigE 0/1/0/9 Holdtime : 155 sec 

 

Version : 

Cisco IOS XR Software, Version 5.3.1.10I[Default] Copyright (c) 2015 by Cisco Systems, Inc. 

 

advertisement version: 2 Duplex: full 

Display Traffic Gathered Between Devices

You can display information about the traffic gathered between devices using CDP by using the show cdp traffic command.

Procedure


Step 1

In the following example, you can see the information displayed about the traffic gathered between devices using CDP.

Router#show cdp traffic

CDP counters : 

Packets output: 250, Input: 120 

Hdr syntax: 0, Chksum error: 0, Encaps failed: 0 

No memory: 0, Invalid packet: 0, Truncated: 0 

CDP version 1 advertisements output: 0, Input: 0 

CDP version 2 advertisements output: 250, Input: 1

Unrecognize Hdr version: 0, File open failed: 0 

Step 2

The following is sample output for the show cdp traffic command. In this example, the optional location keyword and node-id argument are used to display information about the traffic gathered between devices using CDP from the specified node.

Router#show cdp traffic 0/5/CPU0 
CDP counters : 

Packets output: 318, Input: 141 

Hdr syntax: 0, Chksum error: 0, Encaps failed: 0 

No memory: 0, Invalid packet: 0, Truncated: 0 

CDP version 1 advertisements output: 0, Input: 0 

CDP version 2 advertisements output: 318, Input: 141 Unrecognize Hdr version: 0, File open failed: 0