Configuring CDP
This chapter describes how to configure the Cisco Discovery Protocol (CDP), and includes the following sections:
•
Information About CDP
•
Guidelines and Limitations
•
Defaults
•
Configuring CDP
•
Monitoring CDP
•
Verifying the CDP Configuration
•
Configuration Example for CDP
•
Additional References
Information About CDP
Cisco Discovery Protocol (CDP) runs over the data link layer and 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.
CDP gathers protocol addresses of neighboring devices and discovers the platform of those devices. CDP runs over the data link layer only. Two systems that support different Layer 3 protocols can learn about each other.
Each device 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.
For more information on VLANs, see the Cisco Nexus 1000V Layer 2 Switching Configuration Guide, Release 4.2(1)SV1(4).
High Availability
Stateless restarts are supported for CDP. After a reboot or a supervisor switchover, the running configuration is applied.
Guidelines and Limitations
CDP has the following configuration guidelines and limitations:
•
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 using the "Enabling or Disabling CDP Globally" procedure.
•
You can configure CDP on physical interfaces and port channels only.
Defaults
Table 2-1 lists the CDP default settings.
Table 2-1 CDP Defaults
|
|
CDP |
Enabled globally and on all interfaces |
CDP version |
Version 2 |
CDP device ID |
System name |
CDP timer |
60 seconds |
CDP hold timer |
180 seconds |
Configuring CDP
This section includes the following topics:
•
CDP Global Configuration
•
Enabling CDP on an Interface
•
Disabling CDP on an Interface
CDP Global Configuration
This section includes the following topics:
•
Enabling or Disabling CDP Globally
•
Advertising a CDP Version
•
Configuring CDP Options
Enabling or Disabling CDP Globally
Use this procedure to enable or disable CDP globally.Although CDP is enabled globally by default, should it be disabled, you can use this procedure to enable it again.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
•
You are logged in to the CLI in EXEC mode.
•
CDP must be enabled globally before you can configure it on an interface.
•
When you globally disable the CDP feature, all CDP configurations are removed.
SUMMARY STEPS
1.
config t
2.
[no] cdp enable
DETAILED STEPS
|
|
|
Step 1 |
config t Example: n1000v# config t n1000v(config)# |
Places you in the CLI Global Configuration mode. |
Step 2 |
[no] cdp enable Example: n1000v(config)# cdp enable Example: n1000v(config)# no cdp enable |
Enables or disables the CDP feature globally. |
Advertising a CDP Version
Use this procedure to designate the CDP version to advertise on the device.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
•
You know the version of CDP currently supported on the device.
•
Only one version of CDP (version 1 or version 2) is advertised at a time for all uplinks and port channels on the switch.
•
For more information about CDP, see the "Information About CDP" section.
SUMMARY STEPS
1.
config t
2.
cdp advertise {v1 | v2}
3.
(Optional) show cdp global
4.
(Optional) copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: n1000v# config t n1000v(config)# |
Places you in the CLI Global Configuration mode. |
Step 2 |
cdp advertise {v1 | v2} Example 1: n1000v(config)# cdp advertise v1 n1000v(config)# Example 2: n1000v(config)# cdp advertise v2 n1000v(config)# |
Assigns the CPD version to advertise. • CDP Version 1 • CDP Version 2 |
Step 3 |
show cdp global |
(Optional) Displays the CDP configuration, indicating the CDP version that is being advertised or sent to other devices. |
|
Example 1: n1000v(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 Example 2: n1000v(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 enabled Sending DeviceID TLV in Default Format |
Step 4 |
copy running-config startup-config Example: n1000v(config)# copy running-config startup-config |
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Configuring CDP Options
Use this procedure to 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
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
•
You can view output from upstream cat6k switch using the show cdp neighbor command.
•
If you are setting the holdtime, you know how long you want CDP to retain neighbor information.
•
If you are setting the CDP timer, you know how often you want CDP to advertise.
•
For more information about CDP, see the "Information About CDP" section.
SUMMARY STEPS
1.
config t
2.
(Optional) cdp format device-id system-name
3.
show cdp neighbors from the upstream device
4.
show cdp neighbors from your device
5.
(Optional) cdp timer seconds
6.
(Optional) cdp holdtime seconds
7.
(Optional) show cdp global
8.
(Optional) copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: n1000v# config t n1000v(config)# |
Places you in the CLI Global Configuration mode. |
Step 2 |
cdp format device-id system-name Example: n1000v(config)# cdp format device-id system-name n1000v(config)# |
(Optional) Specifies that CDP uses the system name for the device ID format. |
Step 3 |
show cdp neighbors |
Displays your device from the upstream device. |
|
Example:
swordfish-6k-2#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
|
Step 4 |
show cdp neighbors |
Displays the upstream device from your device, |
|
n1000v(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,
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
|
Step 5 |
cdp holdtime seconds Example: n1000v(config)# cdp holdtime 10 |
(Optional) Sets the maximum amount of time that CDP holds onto neighbor information before discarding it. • The range is from 10 to 255 seconds. • The default is 180 seconds. |
Step 6 |
cdp timer seconds Example: n1000v(config)# cdp timer 5 |
(Optional) Sets the refresh time for CDP to send advertisements to neighbors. • The range is from 5 to 254 seconds. • The default is 60 seconds. |
Step 7 |
show cdp global |
Displays the global CDP configuration. |
|
Example: n1000v(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 |
Step 8 |
copy running-config startup-config Example: n1000v(config-if)# copy running-config startup-config |
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
CDP Interface Configuration
This section includes the following procedures:
•
Enabling CDP on an Interface
•
Disabling CDP on an Interface
Enabling CDP on an Interface
Use this procedure to enable CDP on a specific interface. Although CDP is enabled by default on all interfaces, should it become disabled, you can use this procedure to enable it again.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
•
The CDP feature is enabled globally. CDP is enabled globally by default, but can also be re-enabled using the "Enabling or Disabling CDP Globally" procedure.
•
For more information about CDP, see the "Information About CDP" section.
SUMMARY STEPS
1.
config t
2.
interface interface-type number
3.
no cdp enable
4.
cdp enable
5.
show cdp interface interface-type number
6.
copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: n1000v# config t n1000v(config)# |
Places you in the CLI Global Configuration mode. |
Step 2 |
interface interface-type number Example: n1000v(config)# interface port-channel 2 n1000v(config-if)# |
Places you in the CLI Interface Configuration mode for the specific interface. |
Step 3 |
no cdp enable Example: n1000v(config-if)# no cdp enable |
Disables CDP on this interface. |
Step 4 |
cdp enable Example: n1000v(config-if)# cdp enable |
Enables CDP on this interface. |
Step 5 |
show cdp interface interface-type number Example: n1000v(config-if)# show cdp interface mgmt0 mgmt0 is up CDP disabled on interface Sending CDP packets every 60 seconds Holdtime is 180 seconds |
(Optional) Displays CDP information for the specified interface. |
Step 6 |
copy running-config startup-config Example: n1000v(config-if)# copy running-config startup-config |
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
This example shows how to enable CDP on port channel 2:
n1000v# config t
n1000v(config)# interface port-channel 2
n1000v(config-if)# no cdp enable
n1000v(config-if)# cdp enable
n1000v(config-if)# copy running-config startup-config
Disabling CDP on an Interface
Use this procedure to disable CDP on a specific interface.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
•
CDP is currently enabled on the device.
Note
If CDP is disabled on the device, then it is also disabled for all interfaces.
•
CDP is currently enabled on the specific interface you want to configure.
•
For more information about CDP, see the "Information About CDP" section.
SUMMARY STEPS
1.
config t
2.
interface interface-type number
3.
no cdp enable
4.
(Optional) show cdp interface interface-type number
5.
(Optional) copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: n1000v# config t n1000v(config)# |
Places you in the CLI Global Configuration mode. |
Step 2 |
interface interface-type number Example: n1000v(config)# interface mgmt0 n1000v(config-if)# |
Places you in the CLI Interface Configuration mode for the specified interface. |
Step 3 |
no cdp enable Example: n1000v(config-if)# no cdp enable |
Disables CDP on the specified interface. |
Step 4 |
show cdp interface interface-type number Example: n1000v(config-if)# show cdp interface mgmt0 |
(Optional) Displays CDP information for an interface. |
Step 5 |
copy running-config startup-config Example: n1000v(config-if)# copy running-config startup-config |
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
This example shows how to disable CDP on mgmt0:
n1000v# config t
n1000v(config)# interface mgmt0
n1000v(config-if)# no cdp enable
n1000v(config-if)# show cdp interface mgmt0
mgmt0 is up
CDP disabled on interface
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
n1000v(config-if)# copy running-config startup-config
Monitoring CDP
To monitor CDP traffic, use the following command:
|
|
show cdp traffic interface interface-type slot/port |
Displays the CDP traffic statistics on an interface. See Example 2-7 |
Clearing CDP Statistics
To clear CDP statistics, use one of the following commands.
|
|
clear cdp counters |
Clears CDP statistics on all interfaces. |
clear cdp counters interface number |
Clears CDP statistics on the specified interface. |
clear cdp table |
Clears the CDP cache for one or all interfaces. |
Verifying the CDP Configuration
To verify the CDP configuration, use one of the following commands:
|
|
show cdp all |
Displays all interfaces that have CDP enabled. See Example 2-1 |
show cdp entry {all | name entry-name} |
Displays the CDP database entries. See Example 2-2 |
show cdp global |
Displays the CDP global parameters. See Example 2-4 |
show cdp interface interface-type slot/port |
Displays the CDP interface status. See Example 2-5 |
show cdp neighbors {detail | interface interface-type slot/port} |
Displays the CDP neighbor status. See Example 2-6 |
Example 2-1 show cdp all
Sending CDP packets every 60 seconds
Sending CDP packets every 60 seconds
Sending CDP packets every 60 seconds
Sending CDP packets every 60 seconds
Sending CDP packets every 60 seconds
Sending CDP packets every 60 seconds
Example 2-2 show cdp entry name
n1000v# show cdp entry name swordfish-6k-2
----------------------------------------
IPv4 Address: 172.28.30.2
Platform: cisco WS-C6503-E, Capabilities: Router Switch IGMP Filtering
Interface: Ethernet2/2, Port ID (outgoing port): GigabitEthernet1/14
Cisco IOS Software, s72033_rp Software (s72033_rp-IPBASE-M), Version 12.2(33)SXH2a,
RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 25-Apr-08 09:11 by prod_rel_team
Example 2-3 show cdp entry all
n1000v# show cdp entry all
----------------------------------------
IPv4 Address: 172.28.30.2
Platform: cisco WS-C6503-E, Capabilities: Router Switch IGMP Filtering
Interface: Ethernet2/2, Port ID (outgoing port): GigabitEthernet1/14
Cisco IOS Software, s72033_rp Software (s72033_rp-IPBASE-M), Version 12.2(33)SXH2a,
RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 25-Apr-08 09:11 by prod_rel_team
----------------------------------------
IPv4 Address: 172.28.30.2
Platform: cisco WS-C6503-E, Capabilities: Router Switch IGMP Filtering
Interface: Ethernet2/3, Port ID (outgoing port): GigabitEthernet1/15
Cisco IOS Software, s72033_rp Software (s72033_rp-IPBASE-M), Version 12.2(33)SXH2a,
RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 25-Apr-08 09:11 by prod_rel_team
----------------------------------------
Platform: cisco WS-C6503-E, Capabilities: Router Switch IGMP Filtering
Interface: Ethernet2/4, Port ID (outgoing port): GigabitEthernet1/16
Cisco IOS Software, s72033_rp Software (s72033_rp-IPBASE-M), Version 12.2(33)SXH2a,
RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 25-Apr-08 09:11 by prod_rel_team
----------------------------------------
Platform: cisco WS-C6503-E, Capabilities: Router Switch IGMP Filtering
Interface: Ethernet2/5, Port ID (outgoing port): GigabitEthernet1/17
Cisco IOS Software, s72033_rp Software (s72033_rp-IPBASE-M), Version 12.2(33)SXH2a,
RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 25-Apr-08 09:11 by prod_rel_team
----------------------------------------
IPv4 Address: 172.28.15.229
Platform: cisco WS-C6503-E, Capabilities: Router Switch IGMP Filtering
Interface: Ethernet2/6, Port ID (outgoing port): GigabitEthernet1/18
Cisco IOS Software, s72033_rp Software (s72033_rp-IPBASE-M), Version 12.2(33)SXH2a,
RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 25-Apr-08 09:11 by prod_rel_team
Example 2-4 show cdp global
n1000v(config)# show cdp global
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is disabled
Sending DeviceID TLV in Default Format
Example 2-5 show cdp interface
n1000v(config)# show cdp interface ethernet 2/3
Sending CDP packets every 60 seconds
Example 2-6 show cdp neighbors interface
n1000v(config)# show cdp neighbors interface ethernet 2/3
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,
Device ID Local Intrfce Hldtme Capability Platform Port ID
swordfish-6k-2 Eth2/3 173 R S I WS-C6503-E Gig1/15
Example 2-7 show cdp traffic interface
n1000v(config)# show cdp traffic interface ethernet 2/3
----------------------------------------
Traffic statistics for Ethernet2/3
Configuration Example for CDP
This example enables the CDP feature and configures the refresh and hold timers:
config t
cdp enable
cdp timer 50
cdp holdtime 100
Additional References
This section includes the following additional information related to CDP:
•
Related Documents
•
Standards
Related Documents
|
|
VLAN |
Cisco Nexus 1000V Layer 2 Switching Configuration Guide, Release 4.2(1)SV1(4) |
Complete command syntax, command modes, command history, defaults, usage guidelines, and examples |
Cisco Nexus 1000V Command Reference, Release 4.2(1)SV1(4a) |
Standards
|
|
No new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature. |
— |
Feature History for CDP
This section provides the CDP feature release history.
|
|
|
CDP |
4.0(4)SV1(1) |
This feature was introduced. |