Cisco Discovery Protocol (CDP)

The Cisco Discovery Protocol (CDP) is a media- and network protocol independent layer 2 protocol that is used to discover information about neighboring network devices. Because CDP operates at the Data Link layer, it doesn’t need a network layer protocol, such as IP or IPX, to transfer information. CDP devices send out periodic advertisements to the MAC multicast address 0100.0ccc.cccc, every 60 seconds by default. The holdtime is 180 seconds by default, when exceeded without receiving advertisements the CDP entry is removed from the CDP table.

CDP runs on all Cisco equipment including routers, switches, bridges and access servers. It gathers information about neighboring devices such as the type of device, software version, and network layer addresses, if configured. This information is stored in a table in the device’s RAM.

CDP is enabled by default, use the following command in global configuration mode to disable CDP for the entire router:
Router(config)# no cdp run

To see if CDP is enabled for the router, and display the current CDP timers, use the following command:
Router> show cdp

To disable CDP on a particular interface, use the following command in interface configuration mode:
Router(config-if)# no cdp enable

One of the most important commands regarding CDP is the show cdp neighbors command. It displays the following information:

* type of device that is discovered
* name of the device
* number and type of the local interface (port)
* number of seconds the CDP advertisement is valid for the port
* device type
* device product number
* port ID

Router02> show cdp neighbors
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge S – Switch, H – Host, I – IGMP, r – Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID
Router01 Ser 0 154 R 2500 Ser 0

When the detail option is added to the command, it will display the following additional information per discovered device:

* Network layer addresses (IP, IPX, AppleTalk, etc.)
* IOS version

Router02> show cdp neighbors detail
————————-
Device ID: Router01
Entry address(es):
IP address: 192.168.22.5
Platform: cisco 2500, Capabilities: Router
Interface: Serial0, Port ID (outgoing port): Serial0
Holdtime : 126 sec

Version :
Cisco Internetwork Operating System Software
IOS ™ 2500 Software (C2500-D-L), Version 12.0(9), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2000 by cisco Systems, Inc.
Compiled Mon 20-Oct-2003 07:29 by jhiemstra

Besides using the built-in IOS commands to display the information gathered by CDP, CDP can also be used in combination with SNMP and a Network Management Station to gather and store information.

The following commands are most probably not part of the CCNA exam(s) but are included for completeness.

Router> show cdp entry [* | ID]
Displays all entries or a specific entry of the CDP table. The show cdp entry * results in the same output as the show cdp neighbors detail command. Specify the Device ID to display a specific entry. Mind that the Device ID is case sensitive.

The show cdp interface command displays the interfaces for which CDP is enabled including the encapsulation type and CDP timers.

The following command displays the CDP counters regarding CDP packets sent and received as well as error statistics:
Router02> show cdp traffic
CDP counters :
Packets output: 48, Input: 36
Hdr syntax: 0, Chksum error: 0, Encaps failed: 6
No memory: 0, Invalid packet: 0, Fragmented: 0

The default update timer of 60 seconds can be changed using the cdp timer command in global configuration mode. For example, the following commands will configure the router to send CDP advertisements every 90 seconds:
Router(config)# cdp timer 90

The default holdtime of 180 seconds can be changed using the cdp holdtime command in global configuration mode:
Router(config)# cdp holdtime 270

To disable CDP globally on a Catalyst 1900 switch (not relevant for CCNA), use the following command:
Console> (enable) set cdp disable

Alternatively, CDP can be disabled on a particular interface. In the following example CDP is disabled for the port 12 on a module 1:
Console> (enable) set cdp disable 1/12

Author: Johan Hiemstra