IT Certification and Training Blog

CDP Basics – Intro to the Cisco Discovery Protocol

Feb 13, 2013 12:32:00 PM / by Kelson Lawrence

By Steven Bassi

As a newly hired network administrator, your duties involve improvement and maintenance of a large campus network. You’ve been given credentials to log on to all devices, but you’ve received no documentation on how the devices are physically connected. So your first task is to document the network topology. How do you get from this:
 

Undocumented Network[figure 1 – undocumented network]

 

 

To this?


Documented network  [figure 2 – documented network]

 

The Cisco Discovery Protocol (CDP) is designed to help tackle such a problem. Physically inspecting devices to document a network is often inefficient and impractical. With CDP, you can use a few show commands to quickly view information about directly connected devices. Depending on the type of device and version of IOS, you can view information such as the host name, the local and remote ports, and the device platform.


Let’s run through the example above to illustrate the commands you would use to document devices and connected interfaces. From the privileged exec mode on P2R3, if you execute the command show cdp neighbors, you might see something like this:

 

P2R3#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
Switch2       Fas0/0     176      T S   3550   Fas 0/2



[figure 3 – show cdp neighbors ouptut]


From the output, you can see that P2R3 is connected to port Fa0/2 on a 3550 switch. Using this information, you can expand your documentation:
 

expanding network documentation[figure 4 – expanding network documentation]


By continuing this process on each discovered device, you can document the entire network.

How Does CDP Work?

A simple way of describing how CDP works is that each device that is running CDP will send out announcements on each of its connected interfaces; each of these announcements includes basic information about the device and the interface. Devices that receive CDP announcements will process them and hold on to them for a specified amount of time. CDP announcements are sent to a multicast address, and because CDP is a Layer 2 protocol, none of these packets are routed.

Configuring CDP

Typically, CDP announcements are sent every 60 seconds, but you can verify the frequency by using the show cdp interface command.

P2R3#show cdp interface
FastEthernet0/0 is up, line protocol is up
encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds


[figure 5 – show cdp interface output]


You can change the frequency of announcements by using the cdp timer seconds command from global configuration mode.


You’ll notice in figure 5 that the holdtime value is 180 seconds. This value is the amount of time that the device will hold on to the CDP packet before discarding it. So, if you disconnect a neighboring device, the CDP information will still show until the holdtime has expired. You can change the holdtime value by using the cdp holdtime seconds command from global configuration mode.


CDP can be enabled or disabled globally on the device, or per interface. If you want to disable CDP for a device, you should use the command no cdp run from global configuration mode. To disable CDP per interface, use the no cdp enable command from interface configuration mode. Figure 6 illustrates disabling and enabling CDP globally on P2R3 and on a single interface, FastEthernet 0/0:


P2R3(config)#no cdp run
P2R3(config)#cdp run
P2R3(config)#interface fa0/0
P2R3(config-if)#no cdp enable
P2R3(config-if)#cdp enable

[figure 6 – disable/enable CDP globally or per interface]

 

CDP Prerequisites and Restrictions

There are some prerequisites and restrictions to using CDP. Because this is a Cisco-proprietary protocol, you may run into problems if your network uses devices from other vendors. CDP isn’t supported on Frame Relay multipoint interfaces, nor will it work on any interfaces that don’t support Subnetwork Access Protocol (SNAP) headers.


By using the information gathered by CDP in conjunction with commands such as show ip interface brief, you can document the host names, connected interfaces, and IP addresses in your network.

 

 

NetSimIf you're studying for your CCENT, CCNA or CCNP certification exams, check out the NetSim demo.

Click me

Topics: CDP, configuring CDP, Cisco Discovery Protocol, how CDP works, CDP Prerequisites and Restrictions

Kelson Lawrence

Written by Kelson Lawrence

Subscribe to Email Updates

Lists by Topic

see all

Posts by Topic

see all

Recent Posts