====== Cisco Discovery Protocol CDP ====== Jan 2024 \\ \\ ---- ==== Introduction ==== Cisco Discovery Protocol (CDP) is a Cisco specific protocol for discovering 'Neighbouring' devices (spelt Neighbor in Cisco world). The protocol allows discovery of devices directly connected to the device being interrogated. CDP is a Cisco specific protocol that only works on Cisco devices (Routers, Switches, Phones etc). \\ ---- ==== Some CDP Facts ==== //**CDP is a Layer 2 discovery protocol**// and so does not use IP Addressing, however CDP can discover the IP Addresses of CDP devices and share them. \\ \\ CDP shares information with and discovers information about neighbouring devices. CDP shared information can include host name, IP Address, device type, etc. Because CDP shares information about the network and devices cdp can be considered by some a security risk and some networks turn it off. CDP is enabled on Cisco Devices by default. Only directly connected neighbours can become CDP neighbours. By default, CDP messages are sent every 60 seconds out of all interfaces that are in an UP state. When a devices receives a CDP message from a neighbouring device, it adds an entry for that device in its CDP Neighbour table. By default, the CDP Holdtime is 180 seconds, so if a neighbour isn't heard from after 180s, it is removed from the CDP Neighbour table. CDPv2 messages are sent by default. LLDP (Link Layer Discovery Protocol) is more of an open standard (IEEE 802.1AB) that competes with CDP. If you have a mixture of switches, say Cisco, Juniper, Netgear etc you should run LLDP and not use CDP. \\ ---- ==== Using CDP ==== CDP is enabled by default on Cisco switches, however it may have been disabled, if you wish to use CDP you can enable it with the following command from CLI: \\ ==== CDP Run ==== To see if CDP is running we can use: cdp run There will be no output from running this command. \\ \\ ==== Show CDP ==== To see how CDP is configured we can use: \\ sh cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled Here we can see that CDP is using the default values. \\ CDP packets are sent every 60 seconds A holdtime value of 180 seconds is set. If no CDP messages from a device are received for 180 seconds then the device is removed from the CDP devices table. CDPv2 is being used. \\ ==== Show CDP Traffic ==== To see what traffic we have we can use: sh cdp traffic CDP counters : Total packets output: 2828, Input: 1510 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: 2828, Input: 1510 \\ Above we can see that this Switch has sent out 2828 CDP packets and received 1510. \\ There have been zero CDP Version 1 advertisements. \\ There have been 2828 output and 1510 input CDP Version 2 advertisements. \\ \\ ==== CDP Neighbors ==== (take care of spelling) \\ sh 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 Switch Gig 0/1 135 S I WS-C2960- Fas 0/1 Rack4Control Gig 0/2 152 S I WS-C2960- Fas 0/2 \\ Look at the diagram below, this is what we have physically: \\ \\ {{ ::cdp_001.png?900 |}} \\ Device ID Local Intrfce Holdtme Capability Platform Port ID \\ Switch Gig 0/1 135 S I WS-C2960- Fas 0/1 \\ Rack4Control Gig 0/2 152 S I WS-C2960- Fas 0/2 \\ \\ Looking at the table above, we are looking at the perspective of Switch A. Switch A can see two switches (2 neighbours) that are connected to it. \\ \\ Device ID Local Intrfce Holdtme Capability Platform Port ID Switch Gig 0/1 135 S I WS-C2960- Fas 0/1 \\ \\ Device ID is the name of the Switch. \\ \\ Local Intrfce is the interface of the switch we are running this command on (So the Switch called Switch is connected to our switch via local interface Gi01) \\ \\ Holdtme is the 180 second time, if this drips down to zero, that device will be removed from the CDP Neighbour table. \\ \\ Capability you can reference to this information at the top of the output: 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 So Capability S and I means the Switch can be a Switch and use IGMP. \\ \\ Platform - This is the detected Switch Model (WS-C2960-) \\ \\ Port ID is the interface of the Neighbour switch that is connected to this switch. \\ \\ ==== CDP Neighbors Detail ==== This command gives a more expansive set of information than "sh cdp neighbor" sh cdp neighbor detail ------------------------- Device ID: Switch Entry address(es): Platform: cisco WS-C2960-48TC-L, Capabilities: Switch IGMP Interface: GigabitEthernet0/1, Port ID (outgoing port): FastEthernet0/1 Holdtime : 159 sec Version : Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(55)SE7, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2013 by Cisco Systems, Inc. Compiled Mon 28-Jan-13 10:22 by prod_rel_team advertisement version: 2 Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF0000000000001CDEA7556980FF0000 VTP Management Domain: '' Native VLAN: 10 Duplex: full Management address(es): ------------------------- Device ID: Rack4Control Entry address(es): IP address: 192.168.200.128 Platform: cisco WS-C2960-48TC-L, Capabilities: Switch IGMP Interface: GigabitEthernet0/2, Port ID (outgoing port): FastEthernet0/2 Holdtime : 175 sec Version : Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(55)SE7, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2013 by Cisco Systems, Inc. Compiled Mon 28-Jan-13 10:22 by prod_rel_team advertisement version: 2 Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF0000000000001CDEA7556B80FF0000 VTP Management Domain: '' Native VLAN: 1 (Mismatch) Duplex: full Management address(es): IP address: 192.168.200.128 \\ It is easy to see that there is much more detail about our neighbors here. \\ \\ ==== Show CDP Interface ==== This gives some basic CDP information for every interface in your switch. sh cdp interface FastEthernet0 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/1 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/2 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/3 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/4 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/5 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/6 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/7 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/8 is up, line protocol is up Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/9 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/10 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/11 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/12 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/13 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/14 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/15 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/16 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/17 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/18 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/19 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/20 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/21 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/22 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/23 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/24 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/25 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/26 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/27 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/28 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/29 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/30 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/31 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/32 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/33 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/34 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/35 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/36 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/37 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/38 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/39 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/40 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/41 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/42 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/43 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/44 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/45 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/46 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/47 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet0/48 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet1/1 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet1/2 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet1/3 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds GigabitEthernet1/4 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds TenGigabitEthernet1/1 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds TenGigabitEthernet1/2 is down, line protocol is down Encapsulation ARPA Sending CDP packets every 60 seconds Holdtime is 180 seconds \\ \\