BACK

Cisco Discovery Protocol

Understanding How CDP Works

CDP is a media and protocol independent protocol that runs on all Cisco-manufactured equipment including routers, bridges, access and communication servers, and switches.  Using CDP, you can view information about all the Cisco devices directly attached to the switch.  In addition, CDP detects native VLAN and port duplex mismatches.

Network management applications can retrieve the device type and SNMP-agent address of neighboring Cisco devices using CDP.  This enables applications to send SNMP queries to neighboring devices.  CDP allows network management applications to discover Cisco devices that are neighbors of already known devices, in particular, neighbors running lower-layer, transparent protocols.

CDP runs on all media that support Subnetwork Access Protocol (SNAP), including LAN and Frame Relay.  CDP runs over the Data Link layer only.  Cisco devices never forward CDP packets.  When new CDP information is received, Cisco devices discard old information.

CDP Default Configuration
Feature Default Value

CDP global enable state

Enabled

CDP port enable state

Enabled on all ports

CDP message interval

60 seconds

CDP holdtime

180 seconds



Getting CDP Timer and Holdtime Information

The following command shows the CDP timer which is how often CDP packets are sent and the CDP holdtime which is the amount of time that the device will hold packets from neighbor devices.

   Router_2#sho cdp
   Global CDP information:
           Sending CDP packets every 60 seconds
           Sending a holdtime value of 180 seconds

Setting the Holdtime and Timer

Use the following commands to set CDP timer and holdtime values.

   Router_2#conf t
   Enter configuration commands, one per line.  End with CNTL/Z.
   Router_2(config)#cdp timer 90
   Router_2(config)#cdp holdtime 360

CDP can be disabled with the no cdp run command in global configuration mode (conf t).

Getting Neighbor Information

Because the router stores the CDP information in its cache memory, you can view it with a show command.  It will only show information about directly connected devices since CDP packet aren't passed through the device.

   Router_2#sho 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
   Router3             Ser 1          120           R        2500      Ser 0
   Router1             Eth 1          180           R        2500      Eth 0
   Switch1             Eth 0          240           S        1900      2
CDP Neighbor Information includes
  • Neighbor's device ID
  • Local port type and number
  • Holdtime value (in seconds)
  • Neighbor's network device capability
  • Neighbor's hardware platform
  • Neighbor's remote port type and number

Show CDP Entry

The sho cdp entry [device id] command shows more information about the specified neighbor.

   Router_2#sho cdp entry Router1
   -------------------------

   Device ID: Router1
   Entry address(es): 
    IP address: 192.168.1.2
   Platform: cisco 2500, Capabilities: Router
   Interface: Ethernet1,  Port ID (outgoing port): Ethernet0
   Holdtime : 180 sec

   Version:
   Cisco Internetwork Operating System Software
   IOS (tm) 2500 Software (2500-JS-L), Version 11.2(15)
   RELEASED SOFTWARE (fcl)
   Copyright (c) 1986-1998 by Cisco Systems, Inc.
   Compiled Mon 06-Jul-98 22:22 by tmullins

Show CDP Neighbors Detail

The following is a sample output for one neighbor from the show cdp neighbors detail command. Additional detail is shown about neighbors, including network address, enabled protocols, and software version.

   router#show cdp neighbors detail
 
   Device ID: 008024 1EEB00 (milan-sw-1-cat9k)
   Entry address(es):
      IP address: 1.15.28.10
   Platform: CAT5000, Capabilities: Switch
   Interface: Ethernet1/0, Port ID (outgoing port): 2/7
   Holdtime : 162 sec
 
   Version :
   Cisco Catalyst 5000
   Duplex Mode: full
   Native VLAN: 42
   VTP Management Domain: `Accounting Group'
 
show cdp neighbors detail Field Descriptions
Field Definition
Device ID The name of the neighbor device and either the MAC address or the serial number of this device.
Entry address(es) A list of network addresses of neighbor devices.
[network protocol] address The network address of the neighbor device. The address can be in IP, IPX, AppleTalk, DECnet, or CLNS protocol conventions.
Platform The product name and number of the neighbor device.
Capabilities The device type of the neighbor. This device can be a router, a bridge, a transparent bridge, a source-routing bridge, a switch, a host, an IGMP device, or a repeater.
Interface The protocol and port number of the port on the current device.
Holdtime The remaining amount of time, in seconds, the current device will hold the CDP advertisement from a transmitting router before discarding it.
Version The software version of the neighbor device.
Duplex Mode The duplex state of connection between the current device and the neighbor device.
Native VLAN The ID number of the VLAN on the neighbor device.
VTP Management Domain A string that is the name of the collective group of VLANs associated with the neighbor device.

Show CDP Traffic

The following example specifies information associated with the show cdp traffic command:

   router# show cdp traffic
 
   Total packets output: 543, Input: 333
   Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
   No memory: 0, Invalid: 0, Fragmented: 0
   CDP version 1 advertisements output: 191, Input: 187
   CDP version 2 advertisements output: 352, Input: 146
show cdp traffic Fields
Field Definition
Total packets output The number of CDP advertisements transmitted by the local device. Note this value is the sum of the CDP Version-1 advertisements output and CDP Version-2 advertisements output fields.
Input The number of CDP advertisements received by the local device. Note this value is the sum of the CDP Version-1 advertisements input and CDP Version-2 advertisements input fields.
Hdr syntax The number of CDP advertisements with bad headers, received by the local device.
Chksum error The number of times the checksum (verifying) operation failed on incoming CDP advertisements.
Encaps failed The number of times CDP failed to transmit advertisements on an interface because of a failure caused by the local device's bridge port.

No memory The number of times the local device did not have enough memory to store the CDP advertisements in the advertisement cache table when the device was attempting to assemble advertisement packets for transmission and parse them when receiving them.
Invalid The number of invalid CDP advertisements received and transmitted by the local device.
Fragmented The number of times fragments or portions of a single CDP advertisement were received by the local device instead of the complete advertisement.
CDP version 1 advertisements output The number of CDP Version-1 advertisements transmitted by the local device.
Input The number of CDP Version-1 advertisements received by the local device.
CDP version 2 advertisements output The number of CDP Version-2 advertisements transmitted by the local device.
Input The number of CDP Version-2 advertisements received by the local device.

Show CDP Interface

To display information about the interfaces on which CDP is enabled, use the show cdp interface privileged EXEC command.

Router#sh cdp interface [type number]

type
(Optional) Type of interface about which you want information.

number
(Optional) Number of the interface about which you want information.
   Router_2#sho cdp interface
   Ethernet0 is up, line protocol is up
      Encapsulation ARPA
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
   Serial0 is up, line protocol is up
      Encapsulation HDLC
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
   Serial1 is up, line protocol is up
      Encapsulation HDLC
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds

BACK