CDP Cisco Discovery Protocol Guide with Examples

This tutorial explains CDP commands (such as show cdp neighbor, cdp status, show cdp entry, no cdp run and no cdp enable) in detail including how to enable and disable CDP protocol in Cisco Router. Learn how to collect important information about neighboring Cisco device from CDP messages.

CDP is a data link layer protocol. It is available in IOS from version 10.3. Routers and catalyst switches support CDP. CDP is enabled by default on all supporting devices. Supporting device can receive and send CDP messages. CDP messages are not forwarded. It means you can get CDP information only about the directly connected devices.

CDP messages are generated as layer two frames and distributed as multicasts. CDP uses SNAP ( Subnetwork Access Protocol) frame type. SNAP is not supported by all media types. Media types supported by SNAP are Ethernet, Token Ring, fiber distributed data interface (FDDI), Asynchronous Transfer Mode (ATM), Point-to-Point Protocol (PPP), High- Level Data Link Control (HDLC), and Frame Relay. With SNAP, CDP is also limited with these media types only.

CDP Information

CDP messages contain useful information about cisco device including following:-

  • IOS version number
  • Hardware platform
  • Hardware capabilities
  • Layer 3 address (IP address) of device
  • Interface that generate CDP message
  • Port ID
  • Number of seconds for CDP advertisement is valid
  • Device type
  • Name of device configured with hostname

CDP messages are generated in every 60 seconds. Hold down time for missing neighbor is 180 seconds. Since CDP is a layer two protocol, CDP messages are not routed across the device.

CDP Examples

For this example you could use any Cisco network simulator software. I personally choose packet tracer for this article. Create a topology as showing in following image, or download this pre-created topology and load in packet tracer.

Blank topology for practice of CDP

CDP Example

In this topology we are using two routers and two switches with following connections.

  • Switch1(Port GigabitEthernet 1/1) is connected with Router0(Port FastEthernet 0/0).
  • Router0(Port serial 0/0/0) is connected with Router1(Port serial 0/0).
  • Router1(Port FastEthernet 0/0) is connected with Switch0(FastEthernet 0/24).

CDP is enabled by default of all supporting device, but not all interfaces on supporting device are enabled by default. Interfaces on router are by default administratively down. We need to enable them before they can send or receive any data packet.

For example enter show cdp neighbors command in privileged mode on switch1.

show cdp neighbors

Switch is not getting any CDP messages from Router0. Switch is connected with router on FastEthernet 0/0 port, which is by default administratively down. You can verify it by entering show ip interface brief command in privileged mode of Router0.

show ip interface brief

We need to configure and enable associated interface on router, before we can take advantage of CDP.

Assign IP Address on FastEthernet0/0 , Serial0/0/0 and enable that.

configure interface on router 1

Same as Router0, assign IP address and enable interface on Router1.

configure router interface

If you are following this practice on packet tracer, connection lines should be change to green after above configuration.

cdp example topology

If your connection lines do not change to green, download this configured topology and match it with your own topology to find out the errors.

Configured topology for cross reference.

CDP Status

CDP is enabled by default on all supporting devices unless you have manually turned it off. Use show cdp command to check the status of CDP on your device.

show cdp command

show cdp command is used to find out the answers of following questions.

  • Is CDP enabled on device ?
  • What is the hold time for CDP messages?
  • What is the time interval between CDP packets ?

show cdp command provides this information globally. To get interface by interface information use show cdp interface command.

show cdp interface biref

How to show CDP neighbors

CDP information is stored locally without forwarding it to neighbors. CDP protocol collects information about device and format it in layer two frame. This frame is being multicast in every 60 seconds. Supporting device can receive this frame and update their CDP tables. Device can get information only from directly connected devices. In our example Router0 is directly connected with Router1 and Switch1. So it will contain information only about Router1 and Switch1. Use show cdp neighbors command to list all connected devices.

show cdp neighbors

In above information,

Device ID :- Hostname of connected device. If you see MAC address here, this indicates that device is not assigned a name so far.

Local Interface :- Remote device is connected with this local port. This is a CDP message receiving port.

Holdtime :- How long this information is valid.

Capability :- S stands for switch and R stands for Router. Capability codes are given in above the output.

Platform:- Hardware platform of remote device.

Port ID :- Our device is connected with remote device on this port. This is a CDP message sending port.

show cdp neighbors command provides brief information about all connected devices.

Use show cdp neighbors detail or show cdp entry * commands to display additional information about connected devices.

show cdp neighbor details

show cdp entry * command is also provide the same details.

show cdp entry

show cdp neighbors detail and show cdp entry * commands display additional information about all connected devices. To get information about specific device use

Router# show cdp entry device's_name

For example to get information about Router1, enter following command

Router# show cdp entry Router

show cdp entry device name

Device name of Router1 is Router. You can get device name with show cdp neighbors command.

From above output we can see that connected device is a 2600 series router running IOS 12.2 (28) and has an IP address of configured on the connected Serial0/0 interface.

Advantage of Router# show cdp entry device's_name command over the show cdp neighbors detail command is that, it lists only the specified neighbor's information.

How to disable CDP

As I already mentioned earlier in this article, CDP is enabled by default on all supporting devices. Unless your router is connected with wan link or untursted device, you should keep CDP enable. CDP protocol take extra caution of bandwidth. CDP information is only 80 bytes in length. If you still need to disable CDP, use following commands.

To disable CDP globally use no cdp run in global configuration mode.

no cdp run

To disable CDP on interface basis use no cdp enable in interface specific mode.


How to enable CDP

CDP is enabled by default. Due to some reason if you have disabled it, enabling it again is quite simple process.

To enable it globally use cdp run command from global configuration mode.

cdp run

To enable it on interface basis use cdp enable command from interface specific mode.

cdp enable

CDP Commands Cheat Sheet

Command Description
Router#show cdp Display globally configured CDP information including timer
Router# show cdp neighbors Display brief information about directly connected devices
Router#show cdp neighbors details Display detailed information about directly connected devices
Router#show cdp entry * Same as show cdp neighbors command, display brief information about all directly connected devices
Router# show cdp entry [device name] Display information about specific device
Router#show cdp interface Display information about interfaces that have running CDP
Router#show cdp traffic Display CDP traffic information
Router#clear cdp counters Reset traffic counter to zero
Router#clear cdp table Clear CDP tables data
Router(config)#cdp run Enable CDP globally
Router(config)#no cdp run Disable CDP globally
Router(config)#cdp holdtime x Change hold down time of CDP
Router(config)#cdp timer x Change how often CDP updates are sent
Router(config-if)#cdp enable Enable CDP on specific interface
Router(config-if)#no cdp enable Disable CDP on specific interface

ComputerNetworkingNotes CCNA Study Guide CDP Cisco Discovery Protocol Guide with Examples