Configuring CDP

This chapter describes how to configure the Cisco Discovery Protocol (CDP) on Cisco MDS 9000 Family switches.

Information About CDP

This section includes information about CDP.

CDP Overview

The Cisco Discovery Protocol (CDP) is an advertisement protocol used by Cisco devices to advertise itself to other Cisco devices in the same network. CDP runs on the data link layer and is independent of Layer 3 protocols. Cisco devices that receive the CDP packets cache the information to make it accessible through the CLI and SNMP.

The Cisco NX-OS software supports CDP on the management Ethernet (mgmt0) interface on the supervisor module and the Gigabit Ethernet interfaces on the IP Storage Services (IPS) and 14/2-port Multiprotocol Services (MPS-14/2) modules. The CDP daemon is restartable and switchable. The running and startup configurations are available across restarts and switchovers.

CDP version 1 (v1) and version 2 (v2) are supported in Cisco MDS 9000 Family switches. CDP packets with any other version number are silently discarded when received.

When the interface link is established, CDP is enabled by default and three CDP packets are sent at 1-second intervals. Following this action, the CDP frames are sent at the globally configured refresh interval.


Note


CDP is not supported on NPV devices.


High Availability for CDP

The Cisco NX-OS software supports stateless restarts for CDP. After a reboot or a supervisor module switchover, the Cisco NX-OS software applies the running configuration. For more information on high availability, see the .

Configuring CDP

This section describes how to configure CDP.

Enabling or Disabling CDP Globally

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

CDP must be enabled 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 when this occurs.

SUMMARY STEPS

  1. configure terminal
  2. cdp enable
  3. (Optional) copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters configuration mode.

Step 2

cdp enable

Example:

switch(config)# cdp enable 

Enables the CDP feature on the entire device. This is enabled by default .

Step 3

(Optional) copy running-config startup-config

Example:

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

Saves this configuration change.

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 when this occurs.

Before you begin

Ensure that CDP is enabled on the device.

SUMMARY STEPS

  1. configure terminal
  2. interface interface-type slot/port
  3. cdp enable
  4. (Optional) show cdp interface interface-type slot/port
  5. (Optional) copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

configure terminal

Example:

switch# configure terminal
switch(config)#

Enters configuration mode.

Step 2

interface interface-type slot/port

Example:

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

Enters interface configuration mode.

Step 3

cdp enable

Example:

switch(config-if)# cdp enable

Enables CDP on this interface. This is enabled by default.

Step 4

(Optional) show cdp interface interface-type 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-if)# copy running-config 
startup-config
(Optional)

Saves this configuration change.

Configuring Optional CDP Parameters

You can use the following optional commands in global configuration mode to modify CDP:

Command

Purpose

cdp advertise {v1 | v2}


Example:
switch(config)# cdp advertise v1

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

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


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

Sets the CDP device ID. The options are as follows:

  • mac-address —MAC address of the chassis.

  • serial-number —Chassis serial number or Organizationally Unique Identifier (OUI).

  • system-name —System name or fully qualified domain name (FQDN).

The default is system-name .

cdp holdtime seconds


Example:
switch(config)# cdp holdtime 150

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

cdp timer seconds


Example:
switch(config)# cdp timer 50

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

Verifying the CDP Configuration

Use the following commands to verify the CDP configuration:

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-type slot/port

Displays the CDP interface status.

show cdp neighbors {device-id | interface interface-type slot/port} [detail]

Displays the CDP neighbor status.

show cdp traffic interface interface-type slot/port

Displays the CDP traffic statistics on an interface.

Clearing CDP Counters and Tables

Use the clear cdp counters command to clear CDP traffic counters for all interfaces. You can issue this command for a specified interface or for all interfaces (management and Gigabit Ethernet interfaces).


switch# clear cdp counters

Use the clear cdp table command to clear neighboring CDP entries for all interfaces. You can issue this command for a specified interface or for all interfaces (management and Gigabit Ethernet interfaces).


switch# clear cdp table interface gigabitethernet 4/1

CDP Example Configuration

This example enables the CDP feature and configures the refresh and hold timers:

configure terminal
  cdp enable
  cdp timer 50
  cdp holdtime 100

Default Settings for CDP

This table lists the CDP default settings.

Table 1. CDP Default Settings

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