Cisco Discovery Protocol Commands

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 7.0.12

This command was introduced.

Usage Guidelines

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 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

Global configuration

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

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 7.0.12

This command was introduced.

Usage Guidelines

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 
    

When CDP adjacency table logging is enabled, a syslog is generated each time a CDP neighbor is added or removed. The following is an example of the log entry:


LC/0/5/CPU0:Jun 5 10:51:18.081 : cdp[109]: %L2-CDP-6-DELETED_NEIGHBOR : 
CDP Neighbour TBA04110127 on interface GigabitEthernet0/5/0/0 
  has been deleted, remote interface 3/2 
  
LC/0/5/CPU0:Jun  5 10:51:33.120 : cdp[109]: %L2-CDP-6-NEW_NEIGHBOR : 
New CDP neighbor TBA04110127 detected on interface GigabitEthernet0/5/0/0, 
  remote interface 3/2
  

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 7.0.12

This command was introduced.

Usage Guidelines

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
                    

clear cdp counters

To reset Cisco Discovery Protocol (CDP) traffic counters to zero (0), use the clear cdp counters command in EXEC mode.

clear cdp counters location node-id

Syntax Description

location node-id

Clears CDP traffic counters for the designated node. The node-id argument is entered in the rack/ slot notation.

Command Default

The counters are set to zero.

Command Modes

EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

No specific guidelines impact the use of this command.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to clear CDP counters. The show cdp traffic output shows that all traffic counters have been reset to zero (0).


RP/0/RP0/CPU0:router# clear cdp counters
RP/0/RP0/CPU0:router# show cdp traffic
  
  CDP counters:
          Packets output: 0, Input: 0
          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: 0, Input: 0
          Unrecognize Hdr version: 0, File open failed: 0
    

clear cdp table

To clear and automatically resize the table that contains Cisco Discovery Protocol (CDP) information about neighbors, use the clear cdp table command in EXEC mode.

clear cdp table location node-id

Syntax Description

location node-id

Clears and resizes the CDP table for the designated node. The node-id argument is entered in the rack/ slot notation.

Command Default

No default behavior or values

Command Modes

EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

Use the clear cdp table command to clear and resize the CDP table that contains the neighbor entries. The new table size is calculated according to the recommended hash table size, as seen in the show cdp command output.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows how to clear and resize the CDP table. The output of the show cdp neighbors command before and after use of the clear cdp table command shows that all information has been deleted from the table:


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
TBA04341195(15la Mg0/RP1/CPU0/0    171        T S         WS-C2924  0/1     
  
RP/0/RP0/CPU0:router# clear cdp table 
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
    

The show cdp command shows that the table has been resized:


RP/0/RP0/CPU0:router# show cdp
  
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is enabled
  

show cdp

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

EXEC

mode.

show cdp

Syntax Description

This command has no keywords or arguments.

Command Default

No default behavior or values

Command Modes

EXEC

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

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

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

EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

No specific guidelines impact the use of this command.

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 interface

To display information about the interfaces on which Cisco Discovery Protocol (CDP) is enabled, use the show cdp interface command in the appropriate mode.

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

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.

Command Default

This command displays information about the interfaces on which CDP has been enabled.

Command Modes

EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

Use the show cdp interface command to display information about any CDP interfaces. When an interface is specified in the command syntax, information is displayed about the specific interface. Not specifying the interface displays information about all interfaces.

Task ID

Task ID

Operations

cdp

read, write

Examples

The following example shows sample output from the show cdp interface command. Information about the status, CDP timer, and holdtime settings is displayed for all interfaces on which CDP is enabled.


RP/0/RP0/CPU0:router# show cdp interface 
  
POS0/2/0/0 is Up
    Encapsulation HDLC
    Sending CDP packets every 120 seconds
    Holdtime is 240 seconds
POS0/2/0/1 is Up
    Encapsulation HDLC
    Sending CDP packets every 120 seconds
    Holdtime is 240 seconds
POS0/2/0/2 is Up
    Encapsulation HDLC
    Sending CDP packets every 120 seconds
    Holdtime is 240 seconds
POS0/2/0/3 is Up
    Encapsulation HDLC
    Sending CDP packets every 120 seconds
    Holdtime is 240 seconds
MgmtEth0/RP1/CPU0/0 is Up
    Encapsulation ARPA
    Sending CDP packets every 120 seconds
    Holdtime is 240 seconds
    

The following example shows sample output from the show cdp interface command with an interface specified. Information about the status, CDP timer, and holdtime settings is displayed for Packet-over-SONET/SDH (POS) interface 0/2/0/1 only.


RP/0/RP0/CPU0:router# show cdp interface pos 0/2/0/1
  
POS0/2/0/1 is Up
    Encapsulation HDLC
    Sending CDP packets every 60 seconds
    Holdtime is 180 seconds
    
Table 3. show cdp interface Field Descriptions

Field

Description

POS0/2/0/1 is Up

Current condition of POS interface 0/0/2/1.

Encapsulation HDLC

Interface is encoding packets using the Cisco HDLC Layer 2 encapsulation.

Sending CDP packets every 60 seconds

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

Holdtime is 180 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.

show cdp neighbors

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

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

EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

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
  
TBA04110127      Gi0/7/0/0       173      T S         WS-C6506  3/9
cisco_1          Gi0/7/0/2       171      R           
ASR9K
     Gi0/4/0/2
    
Table 4. show cdp neighbors Field Descriptions

Field

Description

Capability Codes

Type of device that can be discovered.

Device ID

Name of the neighbor device.

Local Intrfce

Protocol being used by the connectivity media and the interface number.

Holdtme

Remaining time, in seconds, for which the current device holds the CDP advertisement from a sending router before discarding it.

Capability

Type of the device listed in the CDP Neighbors table. Values are as follows:

R—Router

T—Transparent bridge

B—Source-routing bridge

S—Switch

H—Host

I—Internet Group Management Protocol (IGMP) device

r—Repeater

Platform

Product number of the device.

Port ID

Protocol and port number of the device.

The following examples illustrates sample output for IPv4 and IPv6 neighbors from the show cpd neighbors command with the detail keyword:


RP/0/RP0/CPU0:routershow cdp neighbor detail
  
-------------------------
Device ID: uut-user
SysName : uut-user
Entry address(es):
IPv4 address: 1.1.1.1
IPv6 address: 1::1
IPv6 address: 2::2
Platform: cisco 12008/GRP, Capabilities: Router
Interface: Gi0/4/0/3
Port ID (outgoing port): Gi0/2/0/3
Holdtime : 177 sec
  
Version :
Cisco IOS XR Software, Version 0.0.0[Default]
Copyright (c) 2005 by cisco Systems, Inc.
  
advertisement version: 2
    
Table 5. show cdp neighbors detail Field Descriptions

Field

Definition

Device ID

Name of the neighbor device.

Entry address(es)

List of network addresses of neighbor devices. The address can be in IP or in Connectionless Network Service (CLNS) protocol conventions.

Platform

Product name and number of the neighbor device.

Capabilities

Device type of the neighbor. This device can be a router, a bridge, a transparent bridge, a source-routing bridge, a switch, a host, an IGMP device, or a repeater.

Interface

Interface being used by the connectivity medium.

Port ID

Port number of the port on the current device.

Holdtime

Remaining time (in seconds) for which the current device holds the CDP advertisement from a sending router before discarding it.

Version

Software version of the neighbor device.

advertisement version

Version number of the advertising protocol.

show cdp traffic

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

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

EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

No specific guidelines impact the use of this command.

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 6. 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.