Saturday, July 23, 2016

Discovery Protocols - Part I

 on  with No comments 
In , , ,  
Introduced in IOS 10.3, the Cisco Discovery Protocol (CDP) is used to share information between directly connected Cisco devices such as routers, switches, IP phones, and access points.  This information includes, but is not limited to: IOS version, hostname, IP address or addresses, native VLAN and power draw for Power over Ethernet devices.  CDP announcements utilize the type-length-value (TLV) format.  Another similar discovery protocol, Cabletron's CDP, known also as the VlanHello Protocol, utilizes the same acronym but is not compatible.  Cabletron's CDP is described in RFC 2641 which was published in August of 1999.

Cisco utilizes the multicast destination address 0100:0ccc:cccc for a number of it's proprietary protocols such as CDP and VTP.   Because it's a multicast address, it's important to note that any device capable of receiving the message will be able to process and act upon the data contained within it.  By default, CDP announcements are sent on all interfaces that support Subnetwork Access Protocol (SNAP) headers such as Ethernet, Frame Relay and ATM. While enabled by default, it can be disabled globally or per interface on a device. 

CDP Version 2 (CDPv2) is the most recent release of the protocol.  With CDPv2, Cisco added a reporting mechanism for more rapid error tracking, sending of error message to the console or a logging server, reporting of mismatched native VLAN ID's on trunks, and reporting of unmatched port duplex states. 

Cisco devices that support CDP store this information within a table in memory.  This information can be viewed using the show cdp neighbors command, as well as through SNMP.  The CDP table is refreshed with every CDP announcement received from a neighboring device and the hold time for that information is zeroed.  By default this hold time is 180 seconds. Once this time has been reached without receiving another CDP announcement, the information is discarded.

Third Party Utilization

Hewlett-Packard supports CDP in it's Procurve product line.  All Procurves that support CDP are able to receive and process CDP announcements to some level.  However, all Procurve models shipped after February 2006 will no longer support transmitting CDP announcements, and previous models will have that capability removed from future software upgrades.  More information about HP and Cisco interoperability can be found in the document HP/Cisco Switching and Routing Interoperability Cookbook.  Dell, Netgear, and other manufacturers use the term Industry Standard Discovery Protocol (ISDP) in reference to their CDP compatible implementation.

With version 2.7.4,  routers and switches are able to receive and process CDP frames.   This support can be configured utilizing the enable lldp cdp, disable lldp cdp, reset lldp cdp and show lldp cdp commands.  These commands also support a number of optional parameters.   The following is an example of the show lldp cdp command.

CDP general information


Enabled ...................... Yes

Number of CDP neighbours ..... 14

SysUpTime .................... 12345.42s
CDP processing time .......... 3.385727s
CDP neighbour add .......... -
CDP neighbour remove ....... 5

The following shows the output of the show lldp cdp entry command, which as you can see, shows most if not all of the information available through CDP for the connected Cisco switch.

CDP entry information
Device ID ................. Switch
Protocol information:
IP address ................
Platform .................... cisco WS-C3750G-24TS
Capabilities ................ Router,Switch,IGMP device
Interface ................... port20
Port ID (outgoing port) ..... GigabitEthernet1/0/10
Holdtime .................... 155s
Cisco Internetwork Operating System Software
IOS (tm) C3750 Software (C3750-I5-M), Version 12.2(20)SE, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Wed 19-May-04 11:52 by yenanh

There is a project hosted on Sourceforge called CDP for Linux, which implements a module for the Linux kernel to receive and interpret CDP announcements.  It makes this data available through the /proc interface as /proc/net/cd_neighbors in a format very similar to show cdp neighbors detail on a Cisco router or switch.  However, the project's last update was in March of 2013 for a version to be utilized with Linux 2.4.18, so its not going to be useful with a modern kernel.  There is also a bundle of tools called CDP Tools which are user space tools to send and receive CDP announcements.  However, the changelog for these tools show their last update to be in 2007, calling into question whether or not they'll even compile at this point, let alone be of any use.

Finally, there are Perl modules such as Net:Packet:CDP and Net:CDP available via CPAN.


Post a Comment

Discuss this post!