Cisco Discovery Protocol (CDP) Commands

This module describes the Cisco IOS XR software commands for monitoring the networking device and network using Cisco Discovery Protocol (CDP).

For detailed information about CDP concepts, configuration tasks, and examples, see the Implementing CDP on Cisco IOS XR Software module in System Management Configuration Guide for Cisco NCS 6000 Series Routers.

cdp

To enable the Cisco Discovery Protocol (CDP) globally or on an interface, use the cdp command in the appropriate configuration mode. To disable CDP globally or on an interface, use the no form of this command.

cdp

no cdp

Syntax Description

This command has no keywords or arguments.

Command Default

CDP is disabled.

Command Modes

Interface configuration

Command History

Release

Modification

Release 3.9.0

No modification.

Release 5.0.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

By default, CDP is disabled globally. To enable CDP, CDP must be enabled globally and then enabled for each interface.

To enable CDP globally, use the cdp command in global configuration mode. To disable CDP globally, use the no form of this command in global configuration mode.

To enable CDP on a specific interface, use the cdp command in interface configuration mode. To disable CDP on a specific interface, use the no form of this command in interface configuration mode.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to globally enable CDP:


RP/0/RP0/CPU0:router(config)# cdp
         

The following example shows how to enable CDP on an interface:



RP/0/RP0/CPU0:router(config-if)# cdp
               

cdp advertise v1

To change the version of Cisco Discovery Protocol (CDP) that is used to communicate with neighboring devices to version 1 (CDPv1), use the cdp advertise v1 command in the appropriate configuration mode. To remove the cdp advertise v1 command from the configuration file and restore the system to its default condition with respect to this command, use the no form of this command.

cdp advertise v1

no cdp advertise [v1]

Syntax Description

This command has no keywords or arguments.

Command Default

Version 2 is enabled.

Command Modes

XR Config mode

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Release 3.9.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

CDPv2 packets are sent by default. CDP also sends and receives CDPv1 packets if the device with which CDP is interacting does not process CDPv2 packets.

CDPv2 adds device information over CDPv1. The additional information that is contained in the CDPv2 messages relates to Native VLAN, VLAN Trunking Protocol (VTP) Management Domain, Ethernet Duplex, and other features.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to set a networking device to send and receive only CDPv1 advertisements:


RP/0/RP0/CPU0:router(config)# cdp advertise v1
       

The following example shows how to restore the default condition (sending and receiving CDPv2 advertisements):


RP/0/RP0/CPU0:router(config)# no cdp advertise
                     

cdp holdtime

To specify the time for which the receiving device should hold a Cisco Discovery Protocol (CDP) packet from your networking device before discarding it, use the cdp holdtime command in the appropriate configuration mode. To remove the cdp holdtime command from the configuration file and restore the system to its default condition with respect to this command, use the no form of this command.

cdp holdtime seconds

no cdp holdtime

Syntax Description

seconds

Holdtime to be sent in the CDP update packets, in seconds. Range is 10 to 255.

Command Default

seconds : 180

Command Modes

XR Config

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Release 5.0.0

This command was introduced.

Release 3.9.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

CDP packets are sent with a time-to-live value or holdtime, that is nonzero after an interface is enabled.

The CDP holdtime must be set to a higher number of seconds than the time between CDP transmissions, which is set using the cdp time command.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to specify that the CDP packets sent from the networking device are held by the receiving device for 60 seconds before being discarded. You might want to set the holdtime lower than the default setting of 180 seconds if information about your networking device changes often and you want the receiving devices to purge this information more quickly.


RP/0/RP0/CPU0:router(config)# cdp holdtime 60
         

cdp log adjacency changes

To log changes to the Cisco Discovery Protocol (CDP) adjacency table, use the cdp log adjacency changes command in the appropriate configuration mode. To disable the logging, use the no form of this command.

cdp log adjacency changes

no cdp log adjacency changes

Syntax Description

This command has no keywords or arguments.

Command Default

CDP adjacency table logging is disabled.

Command Modes

XR Config mode

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Release 3.9.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

When CDP adjacency table logging is enabled, a syslog is generated each time a CDP neighbor is added or removed.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to enable CDP adjacency table logging:


RP/0/RP0/CPU0:routerconfigure 
RP/0/RP0/CPU0:router(config)# cdp log adjacency changes 
    

cdp timer

To specify how often the software sends Cisco Discovery Protocol (CDP) updates, use the cdp timer command in the appropriate configuration mode. To remove the cdp timer configuration command from the configuration file and restore the system to its default condition with respect to this command, use the no form of this command.

cdp timer seconds

no cdp timer

Syntax Description

seconds

Frequency with which the Cisco IOS XR software sends CDP updates, in seconds. Range is 5 to 254. The default is 60.

Command Default

seconds : 60

Command Modes

XR Config mode

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Release 3.9.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

A lower timer setting causes CDP updates to be sent more frequently.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to set the CDP timer to 80 seconds, which is less frequent than the default setting of 60 seconds:


RP/0/RP0/CPU0:router(config)# cdp timer 80
                    

show cdp

To display global Cisco Discovery Protocol (CDP) information, including CDP version, timer, and holdtime information, use the show cdp command in

XR EXEC

mode.

show cdp

Syntax Description

This command has no keywords or arguments.

Command Default

No default behavior or values

Command Modes

XR EXEC

Release

Modification

Release 5.0.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

Use the show cdp command to display CDP version, timer, and holdtime information relative to CDP operations.

Task ID

Task ID

Operations

cdp

read

Examples

The following example shows how to use the show cdp command to verify the CDP global settings:


RP/0/RP0/CPU0:router# show cdp
  
Global CDP information:
        Sending CDP packets every 20 seconds
        Sending a holdtime value of 30 seconds
        Sending CDPv2 advertisements is not enabled
    
Table 1. show cdp Field Descriptions

Field

Definition

Sending CDP packets every 20 seconds

Interval between transmissions of CDP advertisements. This field is controlled by the cdp timer command.

Sending a holdtime value of 30 seconds

Time for which the device directs the neighbor to hold a CDP advertisement before discarding it. This field is controlled by the cdp holdtime command.

Sending CDPv2 advertisements is not enabled

State of being enabled or disabled for the transmission of CDP version 2-type advertisements. This field is controlled by the cdp advertise v1 command.

show cdp entry

To display information about a specific neighboring device or all neighboring devices discovered using Cisco Discovery Protocol (CDP), use the show cdp entry command in

XR EXEC

mode.

show cdp entry {* | entry-name} [protocol | version]

Syntax Description

*

Displays all CDP neighbors.

entry-name

Name of a neighbor about which you want information.

protocol

(Optional) Displays protocol information associated with CDP neighbor entries.

version

(Optional) Displays version information associated with CDP neighbor entries.

Command Default

This command displays information about a particular device that has been discovered by CDP.

Command Modes

XR EXEC

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Release 3.9.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows sample output from the show cdp entry command. Information about device ID, address, platform, interface, holdtime, and version is displayed.


RP/0/RP0/CPU0:router# show cdp entry TBA04341195 
  
-------------------------
Device ID: TBA04341195(sys-235)
SysName : sys-235
Entry address(es):
  IP address: 172.16.23.9
Platform: WS-C6006,  Capabilities: Trans-Bridge Switch
Interface: MgmtEth0/RP1/CPU0/0
Port ID (outgoing port): 4/18
Holdtime : 157 sec
  
Version :
WS-C6006 Software, Version McpSW: 7.2(2) NmpSW: 7.2(2)
Copyright (c) 1995-2002 by Cisco Systems
  
advertisement version: 2
VTP Management Domain: 'sys'
Native VLAN: 125
Duplex: full
    
Table 2. show cdp entry Field Descriptions

Field

Description

Device ID

ID code assigned during installation of the router.

Entry address(es)

Addresses of the platform, selected interface, and port ID.

Platform

Platform name.

Capabilities

Special functions that the platform can perform (in this case the platform is a trans-bridge switch).

Interface

Interface location expressed in rack / slot / module / port notation.

Port ID (outgoing port)

Location of the port in use by the interface.

Holdtime

Time (in seconds) for which the device directs the neighbor to hold a CDP advertisement before discarding it. This field is controlled by the cdp holdtime command.

Version

Software version.

advertisement version

Version number of the advertising protocol.

VTP Management Domain

VLAN Trunking Protocol (VTP) domain name of neighbor device.

Native VLAN

VLAN ID.

Duplex

Duplex setting: half or full.

show cdp neighbors

To display detailed information about neighboring devices discovered using Cisco Discovery Protocol (CDP), use the show cpd neighbors command in

XR EXEC

mode.

show cdp neighbors [type interface-path-id | location node-id] [detail]

Syntax Description

type

(Optional) Interface type. For more information, use the question mark ( ? ) online help function.

interface-path-id

(Optional) Physical interface or virtual interface.

Note 

Use the show interfaces command to see a list of all interfaces currently configured on the router.

For more information about the syntax for the router, use the question mark (? ) online help function.

location node-id

(Optional) Displays detailed CDP information for the designated node. The node-id argument is entered in the rack/ slot notation.

detail

(Optional) Displays detailed information about a neighbor or neighbors, including network address, enabled protocols, holdtime, and software version. The output includes information about both IPv4 and IPv6 addresses.

Command Default

No default behavior or values

Command Modes

XR EXEC

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

Use the show cpd neighbors command to display information about any CDP neighbors. When a location is specified in the command syntax, information about the neighbor is displayed for the specified node. Not specifying the location displays information about the neighbor for all interfaces.

Use the command with the detail keyword to display additional information, including IPv6 neighbors.

Task ID

Task ID

Operations

cdp

read

Examples

The following example shows sample output from the show cpd neighbors command:


RP/0/RP0/CPU0: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
router1 Mg0/0/CPU0/0 177 T S WS-C2924M Fa0/12
router2 PO0/4/0/0 157 R 12008/GRP PO0/4/0/1

show cdp traffic

To display information about the traffic gathered between devices using Cisco Discovery Protocol (CDP), use the show cdp traffic command in

XR EXEC

mode.

show cdp traffic [location node-id]

Syntax Description

location node-id

(Optional) Displays CDP information for the CDP packets sent and received on the designated node only. The node-id argument is entered in the rack/ slot notation.

Command Default

Displays CDP information aggregated across all nodes.

Command Modes

XR EXEC

Command History

Release

Modification

Release 5.0.0

This command was introduced.

Release 3.9.0

No modification.

Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

Task ID

Task ID

Operations

cdp

read

Examples

The following example illustrates sample output from the show cdp traffic command:


RP/0/RP0/CPU0:router# show cdp traffic 
  
CDP counters :
          Packets output: 50662, Input: 40414
          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: 50662, Input: 40414
          Unrecognize Hdr version: 0, File open failed: 0
    
Table 3. show cdp traffic Field Descriptions

Field

Definition

Packets output

Number of CDP advertisements sent by the local device. Note that this value is the sum of the CDP version 1 advertisements output field and the CDP version 2 advertisements output field.

Input

Number of CDP advertisements received by the local device. Note that this value is the sum of the CDP version 1 advertisements input field and the CDP version 2 advertisements input field.

Hdr syntax

Number of CDP advertisements having bad headers that have been received by the local device.

Chksum error

Number of times the checksum (verifying) operation failed on incoming CDP advertisements.

Encaps failed

Number of times CDP failed to send advertisements on an interface because of a failure caused by the bridge port of the local device.

No memory

Number of times that the local device did not have enough memory to store the CDP advertisements in the advertisement cache table when the device was attempting to assemble advertisement packets for transmission and parse them when receiving them.

Invalid packet

Number of invalid CDP advertisements received and sent by the local device.

Truncated

Number of times truncated CDP advertisements were sent because there was not enough space in the CDP packet to hold all CDP type-length-values (TLVs).

CDP version 1 advertisements output

Number of CDP version 1 advertisements sent by the local device.

Input

Number of CDP version 1 advertisements received by the local device.

CDP version 2 advertisements output

Number of CDP version 2 advertisements sent by the local device.

Input

Number of CDP version 2 advertisements received by the local device.

Unrecognize Hdr version

Number of packets received from a CDP version that was outside the current configuration.

File open failed

Number of times that CDP failed to connect to one of the underlying services it uses.