CDP, or Cisco Discovery Protocol, runs on Cisco devices to learn about directly connected devices. It runs on Layer 2 and sends to multicast address 01:00:0C:CC:CC:CC.
Embedded within CDP advertisements are TLVs, or type-length-value. The advertisements contain time-to-live information and are sent every 60 seconds. Additional information is inside an advertisement:
- Cisco IOS Version
- Hardware platform
- IP addresses of interfaces
- Locally connected devices advertising CDP
- Active interfaces
- Duplex setting
- VTP domain
- Native VLAN
CDP can be enabled and disabled globally with the
cdp run command. To disable, add the no keyword in front.
To enable/disable CDP on an interface:
config t interface g1/0/1 no cdp enable
The CDP transmission time specifies the frequency of transmitting CDP packets. It can be tuned with the
cdp timer seconds command.
The CDP hold time specifies the time for which a receiving device should hold information before discarding it and the command to tune the hold time is
cdp holdtime seconds.
CDP version 2 is the latest release and in order to enable or disable CDP v2 advertisements use the
cdp advertise-v2 command.
Monitoring and Maintaining CDP
There are number of commands used to monitor CDP. There are two clear cdp commands used to reset and clear information. The other five are show commands.
clear cdp counters will reset the CDP traffic counters on the switch.
clear cdp table will remove the CDP information about neighbors from the table.
show cdp will display information such as interval between advertisements, holdtime value, and whether CDPv2 advertisements are enabled.
SW2#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 entry device_name [protocol | version] will display information about a specific neighbor.
SW2#show cdp entry SW1 ------------------------- Device ID: SW1 Entry address(es): IP address: 10.10.10.2 Platform: Cisco WS-C3550-24, Capabilities: Router Switch IGMP Interface: GigabitEthernet1/0/24, Port ID (outgoing port): FastEthernet0/24 Holdtime : 141 sec Version : Cisco IOS Software, C3550 Software (C3550-IPSERVICESK9-M), Version 12.2(44)SE6, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Mon 09-Mar-09 20:28 by gereddy advertisement version: 2 Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF000000000000000DBDD34E80FF0000 VTP Management Domain: 'CISCO' Native VLAN: 1 Duplex: full Power Available TLV: Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0 Management address(es): IP address: 10.10.10.2
SW2#show cdp entry SW1 protocol Protocol information for SW1 : IP address: 10.10.10.2
SW2#show cdp entry SW1 version Version information for SW1 : Cisco IOS Software, C3550 Software (C3550-IPSERVICESK9-M), Version 12.2(44)SE6, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Mon 09-Mar-09 20:28 by gereddy
show cdp interface will display information about interfaces on which CDP is enabled.
SW2#show cdp interface FastEthernet0 is administratively down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet1/0/1 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds
show cdp neighbors will give you a list of neighbor devices and their information.
SW2#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID SW1 Gig 1/0/24 135 R S I WS-C3550- Fas 0/24
show cdp traffic will give you the information about CDP traffic.
SW2#show cdp traffic CDP counters : Total packets output: 12, Input: 5 Hdr syntax: 0, Chksum error: 0, Encaps failed: 0 No memory: 0, Invalid packet: 0, CDP version 1 advertisements output: 0, Input: 0 CDP version 2 advertisements output: 12, Input: 5