The Cisco Discovery Protocol (CDP), which runs over the data link layer, is used to advertise information to all attached Cisco devices and to discover and view information about attached Cisco devices. CDP runs on all Cisco-manufactured equipment.
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 discarding 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/half duplex
MTU
Sysname
SysObjectID
Management address
Physical location
All CDP packets include a VLAN ID. The CDP packet is untagged, so it goes over the native/access VLAN, which is then also added to the packet.
Stateless restarts are supported for CDP. After a reboot or a supervisor switchover, the running configuration is applied.
Guidelines and Limitations
CDP gathers protocol addresses of neighboring devices and discovers the platform of those devices. CDP runs over the data link layer only. With CDP, two systems that support different Layer 3 protocols can learn about each other.
CDP can discover up to 256 neighbors per port if the port is connected to a hub with 256 connections.
CDP must be enabled globally before you can configure CDP on an interface. CDP is enabled globally by default but can be disabled.
You can configure CDP on physical interfaces and port channels only.
Copies the running configuration to the startup configuration.
switch# config t
switch(config)# cdp advertise v1
switch(config)# show cdp global
Global CDP information:
CDP enabled globally
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is disabled
Sending DeviceID TLV in Default Format
switch(config)# copy running-config startup-config
Configuring CDP Options
You can configure the following for CDP:
The device ID format to use
Note
Only the system-name device ID format is supported
The maximum hold time for neighbor information
The refresh time for sending advertisements
Note
You can view output from the upstream Catalyst 6500 Series switch by using the show cdp neighbor command.
Before You Begin
Before beginning this procedure, be sure you know the following information:
How long you want CDP to retain neighbor information if you are setting the holdtime.
How often you want CDP to advertise if you are setting the CDP timer.
Procedure
Command or Action
Purpose
Step 1
switch# config t
Places you in global configuration mode.
Step 2
switch(config)#
cdp format device-id system-name
(Optional)
Specifies that CDP uses the system name for the device ID format.
Step 3
switch(config)# show cdp neighbors
Displays your device from the upstream device.
Step 4
switch(config)# show cdp neighbors
Displays the upstream device from your device.
Step 5
switch(config)# cdp holdtime seconds
(Optional)
Sets the maximum amount of time that CDP holds onto neighbor information before discarding it.
The range for the seconds argument is from 10 to 255 seconds.
The default is 180 seconds.
Step 6
switch(config)# cdp timerseconds
(Optional)
Sets the refresh time for CDP to send advertisements to neighbors.
The range for the seconds argument is from 5 to 254 seconds.
Step 7
switch(config)# show cdp global
(Optional)
Displays the CDP version that is being advertised or sent to other devices.
Copies the running configuration to the startup configuration.
switch# config t
switch(config)# cdp format device-id system-name
switch# show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
02000c000000 Gig 1/16 14 S Soft Swit Eth 2/4
02000c000000 Gig 1/17 14 S Soft Swit Eth 2/5
02000c000000 Gig 1/14 14 S Soft Swit Eth 2/2
02000c000000 Gig 1/15 14 S Soft Swit Eth 2/3
02000c000000 Gig 1/18 13 S Soft Swit
switch(config)# show cdp neighbors
Capability Codes: R - Router, T - Trans-Bridge, B - Source-Route-Bridge
S - Switch, H - Host, I - IGMP, r - Repeater,
V - VoIP-Phone, D - Remotely-Managed-Device,
s - Supports-STP-Dispute
Device ID Local Intrfce Hldtme Capability Platform Port ID
swordfish-6k-2 Eth2/2 169 R S I WS-C6503-E Gig1/14
swordfish-6k-2 Eth2/3 139 R S I WS-C6503-E Gig1/15
swordfish-6k-2 Eth2/4 135 R S I WS-C6503-E Gig1/16
swordfish-6k-2 Eth2/5 177 R S I WS-C6503-E Gig1/17
swordfish-6k-2 Eth2/6 141 R S I WS-C6503-E Gig1/18
switch(config)# cdp holdtime 10
switch(config)# cdp timer 5
switch(config)# show cdp global
Global CDP information:
CDP enabled globally
Sending CDP packets every 5 seconds
Sending a holdtime value of 10 seconds
Sending CDPv2 advertisements is disabled
Sending DeviceID TLV in Mac Address Format
switch(config-if)# copy running-config startup-config
Copies the running configuration to the startup configuration.
switch# config t
switch(config)# interface port-channel 2
switch(config-if)# no cdp enable
switch(config-if)# cdp enable
switch(config-if)# show cdp interface mgmt0
mgmt0 is up
CDP disabled on interface
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
switch(config)# copy running-config startup-config
Disabling CDP on an Interface
Before You Begin
Before beginning this procedure, be sure of the following:
CDP is currently enabled on the device.
Note
If CDP is disabled on the device, it is also disabled for all interfaces.
CDP is currently enabled on the specific interface you want to configure.
Procedure
Command or Action
Purpose
Step 1
switch# config t
Places you in global configuration mode.
Step 2
switch(config)# interfaceinterface-type number
Places you in interface configuration mode for the specific interface.
Step 3
switch(config-if)# no cdp enable
Disables CDP on this interface.
Step 4
switch(config-if)# show cdp interfaceinterface-type number
(Optional)
Displays CDP information for the specified interface.
Copies the running configuration to the startup configuration.
switch# config t
switch(config)# interface mgmt0
switch(config-if)# no cdp enable
switch(config-if)# show cdp interface mgmt0
mgmt0 is up
CDP disabled on interface
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
switch(config)# copy running-config startup-config
Monitoring CDP
Command
Purpose
show cdp traffic interfaceinterface-type slot/port
Displays the CDP traffic statistics on an interface.