Configuring CDP

This chapter describes how to configure the Cisco Discovery Protocol (CDP) on Cisco NX-OS devices.

This chapter includes the following sections:

About CDP

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.

CDP gathers protocol addresses of neighboring devices and discovers the platform of those devices. CDP runs over the data link layer only. Two systems that support different Layer 3 protocols can learn about each other.

Each device that you configure for CDP sends periodic advertisements to a multicast address. Each device advertises at least one address at which it can receive SNMP messages. The advertisements also contain hold-time information, which indicates the length of time that a receiving device should hold CDP information before removing it. You can configure the advertisement or refresh timer and the hold timer.

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

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

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.

VTP Feature Support

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.

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.

Guidelines and Limitations for CDP

CDP has the following configuration 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.

Default Settings for CDP

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

Configuring CDP


Note


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

Enabling or Disabling CDP 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.

Procedure

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal switch(config)#

Enters global configuration mode.

Step 2

[no] cdp enable

Example:

switch(config)# cdp enable

Enables or disables the CDP feature on the entire device. It is enabled by default.

Step 3

(Optional) copy running-config startup-config

Example:

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

Copies the running configuration to the startup configuration.

Enabling or Disabling CDP 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

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters global configuration mode.

Step 2

interface interface slot/port

Example:

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

Enters interface configuration mode.

Step 3

[no] cdp enable

Example:

switch(config-if)# cdp enable

Enables or disables CDP on this interface. It is enabled by default.

Note

 
Make sure that CDP is enabled globally on the device.

Step 4

(Optional) show cdp interface interface slot/port

Example:

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

Displays CDP information for an interface.

Step 5

(Optional) copy running-config startup-config

Example:

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

Copies the running configuration to the startup configuration.

Configuring Optional CDP Parameters

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

Procedure

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal switch(config)#

Enters global configuration mode.

Step 2

(Optional) cdp advertise {v1 | v2}

Example:

switch(config)# cdp advertise v1
(Optional)

Sets the CDP version that is supported by the device. The default is v2.

Step 3

(Optional) cdp format device-id {mac-address | serial-number | system-name}

Example:

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

Sets the CDP device ID. 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

(Optional) cdp holdtime seconds

Example:

switch(config)# cdp holdtime 150
(Optional)

Sets the time that CDP holds onto neighbor information before removing it. The range is from 10 to 255 seconds. The default is 180 seconds.

Step 5

(Optional) cdp timer seconds

Example:

switch(config)# cdp timer 50
(Optional)

Sets the refresh time when CDP sends advertisements to neighbors. The range is from 5 to 254 seconds. The default is 60 seconds.

Step 6

(Optional) copy running-config startup-config

Example:

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

Copies the running configuration to the startup configuration.

Verifying the CDP Configuration

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.

Configuration Example for CDP

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