CDP is a Cisco proprietary protocol used to collect information from devices on the network that is directly connected, such as hardware, software, device name and more.
CDP, a Cisco proprietary protocol, is not compatible with other brands, operates at layer 2 (data link), and is enabled by default.
CDP is currently in version 2:
- V1:- This version only collected information from the neighboring device.
- V2:- With this version CDP included improvements, CDP can identify a mismatch with the native vlan IDs or a mismatch in the duplex of the devices that are directly connected to it.
Command to view the version, announcement interval, and holdtime of CDP:
Switch#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled Switch#
As seen in the previous output, CDP advertisements are sent every 60 seconds by default, which are sent for each active interface. If after 180 seconds the switch does not receive CDP advertisements for any interface, it proceeds to delete the neighbor.
Command to show the information about the CDP announcements that a switch has received:
Switch# show cdp neighbors [ type member/module/number] [ detail] Switch# show cdp neighbors gig1/0/24
Switch# 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 SW5 Fas 1/4 166 S I WS-C3750G-Gig 1/0/13 Switch03 Gig 2/1 139 S I WS-C3750G-Gig 1/0/85 SW6 Fas 5/10 142 S I WS-C3750G-Gig 1/0/18 FA3A55D Fas 0/9 132 H P IP Phone 7 Port 1 SW7 Fas 0/5 162 S I WS-C3750G-Gig 1/0/11 SWVLAN Fas 0/3 166 S I WS-C3750G-Gig 1/0/19 SW1 Fas 0/8 155 S I WS-C3750G-Gig 1/0/16 SW2 Gig 1/40 140 S I WS-C3750G-Gig 1/0/12 Switch#
Add the keyword detail to view all CDP information received from an advertisement.
Switch# show cdp neighbors detail
The above command will display the detailed information of all known devices through CDP. We can filter the information through a single interface:
Switch# show cdp neighbors Fas 1/1 det ------------------------- Device ID: Sw01 Entry address(es): IP address: 10.2.6.4 Platform: cisco WS-C3750G-24TS-1U, Capabilities: Switch IGMP Interface: FastEthernet1/1, Port ID (outgoing port): GigabitEthernet2/0/24 Holdtime : 169 sec Version : Cisco IOS Software, C3750 Software (C3750-ADVIPSERVICESK9-M), Version 12.2(44)SE6, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Mon 09-Mar-09 17:56 by gereddy advertisement version: 2 Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF000000000000FCFBFB780E00FF0000 VTP Management Domain: '' Native VLAN: 1 Duplex: full Switch#
To disable CDP globally it is done with the following command:
! Switch(config)# no cdp run !
Sometimes, for security reasons, you may want to disable CDP announcements on an individual interface and/or interfaces that are not connected to Cisco equipment:
! Switch(config)# int fa0/12 Switch(config-if)# [no] cdp enable !
In summary, here is a list of commands to configure CDP:
(config)# cdp run Enables CDP globally on device. (config)# no cdp run Disables CDP globally on device. (config-if)# cdp enable Enables CDP on an interface device if CDP is enabled globally. (config-if)# no cdp enable Disables CDP on an interface device. (config)# cdp timer <seconds> (config)# cdp holdtime <seconds>
! Switch# clear cdp counters Switch# clear cdp table Switch# show cdp Switch# show cdp entry device-name [protocol | version] Switch# show cdp interface [type number] Switch# show cdp neighbors [type number] [detail] Switch# show cdp traffic !