Table Of Contents
Configuring CDP
Understanding How CDP Works
Default CDP Configuration
Configuring CDP on the Switch
Setting the CDP Global Enable State
Setting the CDP Enable State on a Port
Setting the CDP Message Interval
Setting the CDP Holdtime
Displaying CDP Neighbor Information
Configuring CDP
This chapter describes how to configure the Cisco Discovery Protocol (CDP) on the Catalyst enterprise LAN switches.
Note
For complete syntax and usage information for the commands that are used in this chapter, refer to the Catalyst 4500 Series, Catalyst 2948G, Catalyst 2948G-GE-TX, and Catalyst 2980G Switches Command Reference.
This chapter consists of these sections:
•
Understanding How CDP Works
•
Default CDP Configuration
•
Configuring CDP on the Switch
Understanding How CDP Works
CDP is a media- and protocol-independent protocol that runs on all Cisco-manufactured equipment including routers, bridges, access and communication servers, and switches. Using CDP, you can view information about all the Cisco devices that are directly attached to the switch. In addition, CDP detects native VLAN and port duplex mismatches.
Network management applications can retrieve the device type and SNMP-agent address of neighboring Cisco devices using CDP. This feature allows applications to send SNMP queries to neighboring devices. CDP allows network management applications to discover Cisco devices that are neighbors of already known devices, in particular, neighbors running lower-layer, transparent protocols.
CDP runs on all media that support Subnetwork Access Protocol (SNAP). CDP runs over the data link layer only.
Cisco devices do not forward CDP packets. When new CDP information is received, old information is discarded.
CDP was enhanced in software release 8.3(1)GLX to facilitate backwards compatibility with the newer, higher-powered Cisco IP phones. With this enhanced CDP, a Cisco IP phone can negotiate its power requirements to the switch within the CDP packet. The switch uses this additional information to ensure that it does not oversubscribe the available power.
Default CDP Configuration
Table 21-1 shows the default CDP configuration.
Table 21-1 CDP Default Configuration
Feature
|
Default Value
|
CDP global enable state
|
Enabled
|
CDP port enable state
|
Enabled on all ports
|
CDP message interval
|
60 sec
|
CDP holdtime
|
180 sec
|
Configuring CDP on the Switch
The following sections describe how to configure CDP.
Setting the CDP Global Enable State
To set the CDP global enable state on the switch, perform this task in privileged mode:
| |
Task
|
Command
|
Step 1
|
Set the CDP global enable state.
|
set cdp {enable | disable}
|
Step 2
|
Verify the CDP configuration.
|
show cdp
|
This example shows how to enable CDP globally and verify the configuration:
Console> (enable) set cdp enable
Console> (enable) show cdp
This example shows how to disable CDP globally and verify the configuration:
Console> (enable) set cdp disable
Console> (enable) show cdp
Setting the CDP Enable State on a Port
You can enable or disable CDP on a per-port basis. You must enable CDP globally before the switch can transmit CDP messages on any ports.
To set the CDP enable state on a per-port basis, perform this task in privileged mode:
| |
Task
|
Command
|
Step 1
|
Set the CDP enable state on individual ports.
|
set cdp {enable | disable} [mod_num/port_num]
|
Step 2
|
Verify the CDP configuration.
|
show cdp port [mod_num[/port_num]]
|
This example shows how to disable CDP on ports 3/1-6 and verify the configuration:
Console> (enable) set cdp disable 3/1-6
CDP disabled on ports 3/1-6.
Console> (enable) show cdp port 3
This example shows how to enable CDP on ports 3/1-2 and verify the configuration:
Console> (enable) set cdp enable 3/1-2
CDP enabled on ports 3/1-2.
Console> (enable) show cdp port 3
Setting the CDP Message Interval
The CDP message interval specifies how often the switch will transmit CDP messages to directly connected Cisco devices.
To set the default CDP message interval, perform this task in privileged mode:
| |
Task
|
Command
|
Step 1
|
Set the default CDP message interval. The allowed range is 5-900 seconds.
|
set cdp interval interval
|
Step 2
|
Verify the CDP configuration.
|
show cdp
|
This example shows how to set the default CDP message interval to 100 seconds and verify the configuration:
Console> (enable) set cdp interval 100
CDP message interval set to 100 seconds for all ports.
Console> (enable) show cdp
Setting the CDP Holdtime
The CDP holdtime specifies how much time can pass between CDP messages from neighboring devices before the device is no longer considered connected and the neighbor entry is aged out.
To set the default CDP holdtime, perform this task in privileged mode:
| |
Task
|
Command
|
Step 1
|
Set the default CDP holdtime. The allowed range is 10-255 seconds.
|
set cdp holdtime interval
|
Step 2
|
Verify the CDP configuration.
|
show cdp
|
This example shows how to set the default CDP holdtime to 225 seconds and verify the configuration:
Console> (enable) set cdp holdtime 225
CDP holdtime set to 225 seconds.
Console> (enable) show cdp
Displaying CDP Neighbor Information
To display information about directly connected Cisco devices, enter the show cdp neighbors command.
To display specific information, use the following keywords:
•
To display the native VLAN for the connected ports, enter the vlan keyword.
•
To display the duplex mode for the connected ports, enter the duplex keyword.
•
To display the device capability codes for the connected device, enter the capabilities keyword.
•
To display the device capability codes for the connected device, enter the detail keyword.
To display information about directly connected Cisco devices, perform this task in privileged mode:
Task
|
Command
|
View information about CDP neighbors.
|
show cdp neighbors [mod_num[/port_num]] [vlan | duplex | capabilities | detail]
|
This example shows how to display CDP neighbor information for connected Cisco devices:
Console> (enable) show cdp neighbors
* - indicates vlan mismatch.
# - indicates duplex mismatch.
Port Device-ID Port-ID Platform
-------- ------------------------------- ------------------------- ------------
2/3 JAB023807H1(2948) 2/2 WS-C2948
3/1 JAB023806JR(4003) 2/1 WS-C4003
3/2 JAB023806JR(4003) 2/2 WS-C4003
3/5 JAB023806JR(4003) 2/5 WS-C4003
3/6 JAB023806JR(4003) 2/6 WS-C4003
This example shows how to display the native VLAN for each port that is connected on the neighboring device (there is a native VLAN mismatch between port 3/6 on the local switch and port 2/6 on the neighbor device, as indicated by the asterisk [*]):
Console> (enable) show cdp neighbors vlan
* - indicates vlan mismatch.
# - indicates duplex mismatch.
Port Device-ID Port-ID NativeVLAN
-------- ------------------------------- ------------------------- ----------
2/3 JAB023807H1(2948) 2/2 522
3/1 JAB023806JR(4003) 2/1 100
3/2 JAB023806JR(4003) 2/2 100
3/5 JAB023806JR(4003) 2/5 1
3/6 JAB023806JR(4003) 2/6* 1
This example shows how to display detailed information about the neighboring device:
Console> (enable) show cdp neighbors 2/3 detail
Device-ID: JAB023807H1(2948)
Capabilities: TRANSPARENT_BRIDGE SWITCH
WS-C2948 Software, Version McpSW: 5.1(57) NmpSW: 5.1(1)
Copyright (c) 1995-1999 by Cisco Systems, Inc.
Port-ID (Port on Neighbors's Device): 2/2
VTP Management Domain: Lab_Network