CDP Commands

This chapter contains the following sections:

cdp advertise-v2

To use Cisco Discovery Protocol (CDP) version 2 for all transmitted CDP packets, use the cdp advertise-v2 Global Configuration mode command.

To use CDP version 1, use the no form of this command.

Syntax

cdp advertise-v2

no cdp advertise-v2

Parameters

N/A

Default Configuration

CDP version 2 is used by default.

Command Mode

Global Configuration mode

Example

switchxxxxxx(config)# cdp run
switchxxxxxx(config)# cdp advertise-v2

cdp appliance-vlan enable

To enable the switch to advertise the voice VLAN in CDP packets on all interfaces that are CPD-enabled and are members of the voice VLAN, use the cdp appliance-vlan enable Global Configuration mode command.

To disable CDP voice VLAN advertisement, use the no form of this command.

Syntax

cdp appliance-vlan enable

no cdp appliance-vlan enable

Parameters

N/A

Default Configuration

CDP voice VLAN advertisement is enabled by default.

Command Mode

Global Configuration mode

User Guidelines

This MIB specifies the voice VLAN ID (VVID) to which this interface belongs:

  • 0—CDP packets transmitting through this interface will contain Appliance VLAN-ID TLV with the value of 0. VoIP and related packets are expected to be sent and received with the value of 0 (VLAN ID=0) and a 802.1p priority.

  • 1 to 4094—CDP packets transmitting through this interface will contain Appliance VLAN-ID TLV with N. VoIP and related packets are expected to be sent and received with the value of N (VLAN ID=N) and a 802.1p priority.

  • 4095—CDP packets transmitting through this interface will contain Appliance VLAN-ID TLV with the value of 4095. VoIP and related packets are expected to be sent and received untagged without a 802.1p priority.

  • 4096—CDP packets transmitting through this interface will not include Appliance VLAN-ID TLV. If the VVID is not supported on the interface, this MIB object will not be configurable and will return 4096.

Example

switchxxxxxx(config)# cdp appliance-vlan enable

cdp device-id format

To specify the format of Device-ID TLV, use the cdp device-id format Global Configuration mode command.

Syntax

cdp device-id format {mac | serial-number | hostname}

Parameters

mac—The Device-ID TLV contains the MAC address of the switch.

serial-number—The Device-ID TLV contains the hardware serial number of the switch.

hostname—The Device-ID TLV contains the hostname of the switch.

Default Configuration

The MAC address of the switch is contained by default.

Command Mode

Global Configuration mode

Example

switchxxxxxx(config)# cdp device-id format serial-number

cdp enable

To enable CDP on an interface, use the cdp enable Interface Configuration mode command.

To disable CDP on an interface, use the no form of this command.

Syntax

cdp enable

no cdp enable

Parameters

N/A

Default Configuration

CDP is enabled on each interface by default.

Command Mode

Interface Configuration mode

User Guidelines

To enable CDP on an interface, you must first enable CDP globally on the switch by using the cdp run command.

Example

switchxxxxxx(config)# cdp run
switchxxxxxx(config)# interface fa5
switchxxxxxx(config-if)# cdp enable

cdp holdtime

To specify the number of seconds that CDP packets are held before the packets are discarded, measured in multiples of the TLV Advertise Interval, use the cdp holdtime Global Configuration mode command.

Syntax

cdp holdtime seconds

Parameters

seconds—Number of seconds that a receiver must keep the advertised CDP information. The holdtime should be bigger than the value of the transmission timer. (Range: 10 to 255 seconds)

For example, if the TLV Advertise Interval is 30 seconds, and the Hold Multiplier is 4, then the CDP packets are discarded after 120 seconds.

Default Configuration

The default CDP holdtime is 180 seconds.

Command Mode

Global Configuration mode

Example

switchxxxxxx(config)# cdp holdtime 120

cdp log mismatch duplex

To enable validating that the duplex status of an interface received in a CDP packet matches its actual configuration, use the cdp log mismatch duplex Interface Configuration mode command.

To disable generating the SYSLOG messages for duplex mismatches, use the no form of this command.

Syntax

cdp log mismatch duplex

no cdp log mismatch duplex

Parameters

N/A

Default Configuration

The switch reports the duplex mismatches from all interfaces.

Command Mode

Interface Configuration mode

User Guidelines

When duplex information is mismatched, which means that the duplex information in the incoming frame does not match what the local device is advertising, a SYSLOG duplex mismatch message is generated by CDP.

Example

switchxxxxxx(config)# interface fa11
switchxxxxxx(config-if)# cdp log mismatch duplex

cdp log mismatch native

To enable validating that the native VLAN received in a CDP packet matches the actual native VLAN of the interface, use the cdp log mismatch native Interface Configuration mode command.

To disable generating the SYSLOG messages for native VLAN mismatches, use the no form of this command.

Syntax

cdp log mismatch native

no cdp log mismatch native

Parameters

N/A

Default Configuration

The switch reports the native VLAN mismatches from all interfaces.

Command Mode

Interface Configuration mode

User Guidelines

When a native VLAN mismatch is detected, which means that the native VLAN information in the incoming frame does not match what the local device is advertising, a SYSLOG message is generated by CDP.

Example

switchxxxxxx(config)# interface fa11
switchxxxxxx(config-if)# cdp log mismatch native

cdp log mismatch voip

To enable validating that the VoIP status of the interface received in a CDP packet matches its actual configuration, use the cdp log mismatch voip Interface Configuration mode command.

To disable generating the SYSLOG messages for VoIP mismatches, use the no form of this command.

Syntax

cdp log mismatch voip

no cdp log mismatch voip

Parameters

N/A

Default Configuration

The switch reports the VoIP mismatches from all interfaces.

Command Mode

Interface Configuration mode

User Guidelines

When a voice VLAN mismatch is detected, which means that the voice VLAN information in the incoming frame does not match what the local device is advertising, a SYSLOG message is generated by CDP.

Example

switchxxxxxx(config)# interface fa11
switchxxxxxx(config-if)# cdp log mismatch voip

cdp mandatory-tlvs validation

To validate that all mandatory (according to CDP protocol) TLVs are present in the received CDP frames, use the cdp mandatory-tlvs validation Global Configuration mode command.

To disable the CDP mandatory TLVs validation, use the no form of this command.

Syntax

cdp mandatory-tlvs validation

no cdp mandatory-tlvs validation

Parameters

N/A

Default Configuration

CDP mandatory TLVs validation is enabled by default.

Command Mode

Global Configuration mode

User Guidelines

If the CDP mandatory TLVs validation is enabled, incoming CDP packets not containing the mandatory TLVs are discarded and the invalid error counter is incremented.

Example

switchxxxxxx(config)# cdp mandatory-tlvs validation

cdp pdu

To specify how to deal with CDP packets when CDP is disabled globally, use the cdp pdu Global Configuration mode command.

Syntax

cdp pdu {bridging | filtering | flooding}

Parameters

bridging—When CDP is globally disabled, bridges CDP packets as regular data packets (forwarded based on VLAN).

filtering—When CDP is globally disabled, filters (deletes) CDP packets.

flooding—When CDP is globally disabled, floods CDP packets to all ports that are in the STP forwarding state, ignoring the VLAN filtering rules.

Default Configuration

Bridging

Command Mode

Global Configuration mode

User Guidelines

When CDP is globally enabled, CDP packets are filtered (discarded) on the
CDP-disabled ports.

In the flooding mode, the VLAN filtering rules are not applied, but the STP rules are applied. In case of MSTP, CDP packets are classified to the instance 0.

Example

The following example specifies that when CDP is globally disabled, CDP packets are flooded to all ports that are in the STP forwarding state:

switchxxxxxx(config)# cdp run
switchxxxxxx(config)# cdp pdu flooding

cdp run

To enable CDP globally on the switch, use the cdp run Global Configuration mode command.

To disable CDP globally on the switch, use the no form of this command.

Syntax

cdp run

no cdp run

Parameters

N/A

Default Configuration

CDP is enabled by default.

Command Mode

Global Configuration mode

User Guidelines

CDP is a link-layer protocol for directly connected CDP devices to advertise themselves and their capabilities. In deployments where the CDP-capable devices are not directly connected and are separated with the CDP-incapable devices, the CDP-capable devices may be able to receive the advertisement from other device(s) only if the CDP-incapable devices flood the CDP packets that they receive. If the CDP-incapable devices perform VLAN-aware flooding, then the CDP-capable devices can hear each other only if they are in the same VLAN. It should be noted that a CDP-capable device may receive the advertisement from more than one device if the CDP-incapable devices flood the CDP packets.

To learn and advertise CDP information, CDP must be globally enabled and also enabled on the interfaces. By default, CDP is enabled globally and enabled on all interfaces.

Example

switchxxxxxx(config)# cdp run

cdp timer

To specify how often CDP packets are transmitted, use the cdp timer Global Configuration mode command.

Syntax

cdp timer seconds

Parameters

seconds—Enter the rate in seconds at which CDP advertisement updates are sent. (Range: 5 to 254 seconds)

Default Configuration

The default transmission timer is 60 seconds.

Command Mode

Global Configuration mode

Example

switchxxxxxx(config)# cdp timer 200

clear cdp counter

To reset the CDP traffic counters to 0, use the clear cdp counter Privileged EXEC Mode command.

Syntax

clear cdp counter

Parameters

N/A

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# clear cdp counter

clear cdp table

To delete all entries in the CDP cache table, use the clear cdp table Privileged EXEC Mode command.

Syntax

clear cdp table

Parameters

N/A

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# clear cdp table

show cdp

To show the CDP global settings, use the show cdp Privileged EXEC mode command.

Syntax

show cdp

Parameters

N/A

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# show cdp
CDP Global Configuration:
         CDP is globally enabled
         CDP log duplex mismatch is globally enabled
         CDP log native VLAN mismatch is globally enabled
         CDP log voice VLAN mismatch is globally enabled
         Mandatory TLVs validation is enabled
         Sending CDPv2 advertisements is enabled
         Sending Appliance TLV is enabled
         Device ID format is Host name
         Sending CDP packets every 200 seconds
         Sending a holdtime value of 180 seconds
         CDP packets handling mode is flooding

show cdp entry

To show information for all CDP neighbors or for a specific CDP neighbor, use the show cdp entry Privileged EXEC mode command. You can limit the display to protocol or version information.

Syntax

show cdp entry {* | WORD} [protocol | version]

Parameters

*—Displays information for all CDP neighbors.

WORD—Displays information for a specific CDP neighbor. You need to specify the name of the CDP neighbor (its device ID) to be displayed.

protocol—(Optional) Displays information about the protocols enabled on the CDP neighbors.

version—(Optional) Displays information about the software version running on the CDP neighbors.

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# show cdp entry * protocol

show cdp interfaces

To show information for the interfaces on which CDP is enabled, use the show cdp interfaces Privileged EXEC mode command.

Syntax

show cdp interfaces interface-id

Parameters

interface-id—The interface ID or a list of interface IDs.

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# show cdp interfaces fa11
---------------------------------------------
CDP is globally enabled
CDP log duplex mismatch
  Globally is enabled
  Per interface is enabled
CDP log voice VLAN mismatch
  Globally is enabled
  Per interface is enabled
CDP log native VLAN mismatch
  Globally is enabled
  Per interface is enabled
fa11 is  Down, CDP is enabled
Sending CDP packets every 200 seconds
Holdtime is 180 seconds

show cdp neighbors

The show cdp neighbors Privileged EXEC mode command displays information about neighbors

Syntax

show cdp neighbors [interface-id] [detail]

Parameters

interface-id—Displays the neighbors attached to this port.

detail—Displays detailed information about a neighbor (or neighbors) from the main cache including network address, enabled protocols, hold time, and software version.

Default Configuration

If an interface ID is not specified, the command displays information for the neighbors of all ports.

Command Mode

Privileged EXEC Mode

User Guidelines

The main cache contains the full received CDP messages about limited number of the neighbors.

Use the show cdp neighbors [interface-id] detail command to display the main cache.

Example

switchxxxxxx# show cdp neighbor interface fa24
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - VoIP Phone
	          Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
          S - Switch, H - Host, I - IGMP, r - Repeater, P - VoIP Phone
          M - Remotely-Managed Device, C - CAST Phone Port,
         W - Two-Port MAC Relay
Device ID       Local      Adv  Holdtime Capability   Platform     Port ID
  Interface  Ver.
------------------ ----------- ---- -------- ---------- ------------ -----------
Switch150101       fa24        2    178      S I        Cisco SG220- gi48
                                                                    			    50P (PID:SG2
                                                    20-50P-K9-NA
                      				                                                 )

show cdp tlv

To show the local device information advertised by the CDP protocol for specific interfaces, use the show cdp tlv Privileged EXEC mode command.

Syntax

show cdp tlv interface-id

Parameters

interface-id—The interface ID or a list of interface IDs.

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# show cdp tlv fa5
CDP is globally enabled
Interface TLV: fa5
CDP is enabled on fa5
Interface fa5 is Up
Device-ID TLV: type is Host name;Value is switchxxxxxx
Address TLV: IPv4 192.168.1.254, IPv6 fe80::66d8:14ff:fe5d:6d36
Port-ID TLV: fa5
Capabilities: Switch IGMP
Version TLV: 1.1.0.9
Platform TLV: MS200X-24P
Native VLAN TLV: 1
Full/Half Duplex TLV: full-duplex
Appliance VLAN-ID TLV: Appliance-ID is 1; VLAN-ID is 1
Extended Trust TLV: extended trust
COS for Untrusted Ports TLV: 0

show cdp traffic global

To show global CDP traffic statistics, use the show cdp traffic global Privileged EXEC mode command.

Syntax

show cdp traffic global

Parameters

N/A

Command Mode

Privileged EXEC Mode

Example

switchxxxxxx# show cdp traffic global
CDP counters :
         Total packets output: 101, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 101, Input: 0

The following table describes the significant fields shown in the example:

Field

Description

Total packets output, input

Total number of CDP packets received and transmitted on all interfaces.

Hdr syntax

Number of times that packet information could not be stored in cache because of lack of room.

Chksum error

Number of packets received with illegal checksum value.

Invalid packet

Number of packets received with errors other than illegal checksums.

CDP version 1 advertisements output, input

Number of CDP version 1 packets received and transmitted on all interfaces.

CDP version 2 advertisements output, input

Number of CDP version 2 packets received and transmitted on all interfaces.

show cdp traffic (Interface)

To show the CDP traffic counters per interface, use the show cdp traffic Privileged EXEC mode command.

Syntax

show cdp traffic [interface-id]

Parameters

interface-id—(Optional) The interface ID or a list of interface IDs. If the ID is not specified, this command will display the CDP counters for all interfaces.

Command Mode

Privileged EXEC Mode

User Guidelines

CDP statistics for an interface are only displayed if CDP is enabled globally and on the interface.

Example

switchxxxxxx# show cdp traffic
fa1 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa2 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa3 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa4 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa5 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa6 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa7 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa8 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa9 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa10 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa11 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa12 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa13 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa14 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa15 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa16 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa17 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa18 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa19 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa20 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa21 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa22 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa23 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
fa24 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
gi1 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0
gi2 :
         Total packets output: 0, Input: 0
         Hdr syntax: 0, Chksum error: 0, Invalid packet: 0
         No memory in main cache: 0
         CDP version 1 advertisements output: 0, Input: 0
         CDP version 2 advertisements output: 0, Input: 0