Cisco Discovery Protocol

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

Overview

The Cisco Discovery Protocol (CDP) is a protocol that enables Cisco devices to discover and share information about directly connected devices at the data link layer.

  • CDP gathers protocol addresses and platform information from neighboring devices.

  • CDP operates at the data link layer and allows devices supporting different Layer 3 protocols to learn about each other.

  • CDP periodically advertises device information, including addresses for SNMP messages and hold-time information.

Features and Operation

CDP runs over the data link layer and enables devices to exchange information even if they support different Layer 3 protocols. Each device configured for CDP sends periodic advertisements to a multicast address, advertising at least one address for SNMP messages and hold-time information. The advertisement and hold timers are configurable.

High Availability - Cisco NX-OS supports both stateful and stateless restarts and switchover for CDP. For more information on high availability, see the Cisco Nexus 9000 Series NX-OS High Availability and Redundancy Guide.

Virtualization Support - Cisco NX-OS supports one instance of CDP.

CDP advertises the following type-length-value fields (TLVs):

  • Device ID

  • Address

  • Port ID

  • Capabilities

  • Version

  • Platform

  • Native VLAN

  • Full or Half Duplex

  • MTU

  • SysName

  • SysObjectID

  • Management Address

  • Physical Location

  • VTP

CDP Version-2 (CDPv2) allows you to track instances where the native VLAN ID or port duplex states do not match between connecting devices.

All CDP packets include a VLAN ID. If you configure CDP on a Layer 2 access port, the CDP packets sent from that access port include the access port VLAN ID. If you configure CDP on a Layer 2 trunk port, the CDP packets sent from that trunk port include the lowest configured VLAN ID allowed on that trunk port. The trunk port can receive CDP packets that include any VLAN ID in the allowed VLAN list for that trunk port. For more information on VLANs, see the Cisco Nexus 9000 Series NX-OS Layer 2 Switching Configuration Guide.

CDP sends the VLAN Trunking Protocol (VTP) type-length-value field (TLV) if the following conditions are met:

  • CDP Version 2 is enabled.

  • The VTP feature is enabled.

  • A VTP domain name is configured.

You can view the VTP information with the show cdp neighbors detail command.

Default Settings

This table lists the default settings for CDP parameters.

Parameters Default
CDP Enabled globally and on all interfaces
CDP version Version 2
CDP device ID Serial number
CDP timer 60 seconds
CDP hold timer 180 seconds

Guidelines and Limitations

  • CDP can discover up to 256 neighbors per port if the port is connected to a hub with 256 connections.

  • CDP must be enabled on the device or you cannot enable it on any interfaces.

  • You can configure CDP on physical interfaces and port channels only.

Release Specific Guidelines

Beginning with Cisco NX-OS Release 10.3.1(F)

  • CDP is supported on the Cisco Nexus 9808 platform switches.

Beginning with Cisco NX-OS Release 10.4(1)F

  • CDP is supported on the following line cards and switches: Cisco Nexus 9804 platform switch, Cisco Nexus X98900CD-A line card, and Cisco Nexus X98900CD-A line card with Cisco Nexus 9808 and 9804 switches

Beginning with Cisco NX-OS Release 10.4(2)F

  • CDP is supported on Cisco Nexus 9232E-B1 platform switches.

Enable or Disable Globally

CDP is enabled by default. You can disable CDP and then reenable it.

You must enable CDP on the device before you enable CDP on any interfaces. If CDP is disabled globally and you enable CDP on specified interfaces, CDP will not be active on those interfaces; the system does not return an error message.


Note


The Cisco NX-OS commands for this feature may differ from those commands that are used in Cisco IOS.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal switch(config)#

Step 2

Enable or disable the CDP feature on the entire device using the command [ no ] cdp enable

Example:

switch(config)# cdp enable

It is enabled by default.

Step 3

(Optional) Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config

This is an optional step.


This example shows how to enable the CDP feature and configure the refresh and hold timers:

configure terminal
cdp enable
cdp timer 50
cdp holdtime 100

What to do next

To display the CDP configuration, perform one of the following tasks:

Command Purpose
show cdp all Displays all interfaces that have CDP enabled.
show cdp entry {all | name entry-name} Displays the CDP database entries.
show cdp global Displays the CDP global parameters.
show cdp interface interface slot/port Displays the CDP interface status.
show cdp neighbors {device-id | interface interface slot/port} [detail] Displays the CDP neighbor status.
show cdp interface interface slot/port Displays the CDP traffic statistics on an interface.

Use the clear cdp counters command to clear CDP statistics on an interface.

Use the clear cdp table command to clear the CDP cache for one or all interfaces.

It is recommended to use the show cdp neighbors detail command instead of show cdp neighbors command. The show cdp neighbors command can display only 13 characters of a platform name. To get the full platform name in the display, use show cdp neighbors detail command.


Note


When both IPv4 and IPv6 configuration exist under an interface, the last updated IP address, either IPv4 or IPv6, is visible in the output of the show cdp neighbors commands. If you need either IPv4 or IPv6 configuration rather than the IP address visible in the output, unconfigure the existing IP configuration and then reconfigure the required IPv4 or IPv6 configuration.


Enable or Disable on an Interface

CDP is enabled by default on an interface. You can disable CDP on an interface.

If CDP is disabled globally and you enable CDP on specified interfaces, CDP will not be active on those interfaces; the system does not return an error message.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
		switch(config)#
					

Step 2

Enter interface configuration mode using the command interface interface slot / port

Example:

switch(config)# interface ethernet 1/2
	switch(config-if)#
					

Step 3

Enable or disable CDP on this interface using the command [ no ] cdp enable

Example:

switch(config-if)# cdp enable
					

It is enabled by default.

Note

 
Make sure that CDP is enabled globally on the device.

Step 4

Display CDP information for an interface using the command show cdp interface interface slot / port

Example:

switch(config-if)# show cdp interface ethernet 1/2
					

This is an optional step.

Step 5

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Configure Optional CDP Parameters

You can use the optional commands in this procedure to modify CDP.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal switch(config)#

Step 2

Set the CDP version that is supported by the device using the command cdp advertise { v1 | v2 }

Example:

switch(config)# cdp advertise v1

This is an optional step. The default is v2.

Step 3

Set the CDP device ID using the command cdp format device-id { mac-address | serial-number | system-name }

Example:

switch(config)# cdp format device-id mac-address

This is an optional step. The options are as follows:

  • mac-address —The MAC address of the chassis.

  • serial-number —The chassis serial number/Organizationally Unique Identifier (OUI).

  • system-name —The system name or fully qualified domain name.

The default is system-name .

Step 4

Set the time that CDP holds onto neighbor information before removing it using the command cdp holdtime seconds

Example:

switch(config)# cdp holdtime 150

This is an optional step. The range is from 10 to 255 seconds. The default is 180 seconds.

Step 5

Set the refresh time when CDP sends advertisements to neighbors using the command cdp timer seconds

Example:

switch(config)# cdp timer 50

This is an optional step. The range is from 5 to 254 seconds. The default is 60 seconds.

Step 6

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config

This is an optional step.