Contents

Introduction
Neighbors
CDP Timer and Hold Time
Disable CDP

Introduction

Cisco Discovery Protocol (CDP) is a Cisco proprietary protocol that only run on Cisco products. By using CDP, network administrators can check the physical connections of the network devices. And also the information of the neighbor devices such as, model and IOS version. The common used version is CDP Version 2. The default CDP version of Cisco equipment is also Version 2.

Neighbors

cdp

Use the above topology as an example. CDP is enable by default. Use show cdp neighbors to check the information of neighbor routers. Try to use the command on R1.

R1#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
R2               Eth 0/0            128        R S I      3640      Eth 0/0
R3               Eth 0/1            133          R        7206VXR   Fas 0/0

Device ID

Hostname of neighbor device.

Local Intrfce

Local Interface, the interface that connect to neighbor device.

Holdtme

CDP packet is sent every 60 seconds. If CDP packet is not received for Hold Time 180 seconds, the neighbor is assumed to be down. Hold Time will count down from 180 until the next CDP packet is received. Hold Time reset to 180 seconds again when receiving CDP packet. If CDP packet is still not received after the Hold Time becomes 0, the record will be cleared.

Capability

The Capability Code of neighbor device, you will know the type of devices by checking the code.

Platform

The model of neighbor device.

Port ID

The connected interface of the neighbor device.

If we want to see more details of the neighbor device, use show cdp neighbors detail command.

R1#show cdp neighbors detail
-------------------------
Device ID: R2
Entry address(es):
  IP address: 192.168.1.1
Platform: Cisco 3640,  Capabilities: Router Switch IGMP
Interface: Ethernet0/0,  Port ID (outgoing port): Ethernet0/0
Holdtime : 173 sec

Version :
Cisco IOS Software, 3600 Software (C3640-JK9S-M), Version 12.4(16), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 20-Jun-07 11:43 by prod_rel_team

advertisement version: 2
VTP Management Domain: ''
Duplex: half

-------------------------
Device ID: R3
Entry address(es):
  IP address: 192.168.2.1
Platform: Cisco 7206VXR,  Capabilities: Router
Interface: Ethernet0/1,  Port ID (outgoing port): FastEthernet0/0
Holdtime : 174 sec

Version :
Cisco IOS Software, 7200 Software (C7200-IK9S-M), Version 12.4(17a), RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 07-Nov-07 21:02 by prod_rel_team

advertisement version: 2
Duplex: full

CDP Timer and Hold Time

If the hostname of R2 is changed, the updated hostname does not displayed immediately. And the old record is still displayed for a long time.

R2(config)#hostname Router2
R1#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
R2               Eth 0/0            128        R S I      3640      Eth 0/0
Router2          Eth 0/0            168        R S I      3640      Eth 0/0
R3               Eth 0/1            133          R        7206VXR   Fas 0/0

To shorten the update time, CDP Timer can be changed. But it will increase the network loading, be careful when changing the timer. Now, try to change the CDP timer to 5 seconds (default 60 seconds).

Router2(config)#cdp timer ?
  <5-254>  Rate at which CDP packets are sent (in  sec)

Router2(config)#cdp timer 5

Use show cdp to check the current timer values.

Router2#show cdp
Global CDP information:
        Sending CDP packets every 5 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled

Check the CDP Neighbor of R1 and it is found that the HoldTme of Router2 reset to 180 everytime when it count down to 175. It proves that the CDP Timer is already set to 5 seconds.

R1#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
Router2          Eth 0/0            179        R S I      3640      Eth 0/0
R3               Eth 0/1            169          R        7206VXR   Fas 0/0

Now, try to change the CDP holdtime at R2.

R2(config)#cdp holdtime ?
  <10-255>  Length  of time  (in sec) that receiver must keep this packet

R2(config)#cdp holdtime 10
R2#show cdp
Global CDP information:
        Sending CDP packets every 5 seconds
        Sending a holdtime value of 10 seconds
        Sending CDPv2 advertisements is  enabled

Check CDP Neighbor on R1, the Holdtime of Router2 counts down from 10 seconds. If no CDP packet is received after 10 seconds, the record will be deleted. So, the devices will be disappeared rapidly when down.

R1#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
Router2          Eth 0/0            6          R S I      3640      Eth 0/0
R3               Eth 0/1            121          R        7206VXR   Fas 0/0

Disable CDP

Since CDP will explode the important information of a device, we may want to disable it in some situations. For example, if I am an ISP, I do not want my customers know the information of my router when their devices is connected to mine.

We can use no cdp enable at interface, then the CDP is disabled.

R2(config)#interface ethernet 0/0
R2(config-if)#no cdp enable

Or we may use Global command no cdp run, then all the interfaces do not send CDP packets.

R2(config)#no cdp run

After CDP is trunned off. The information of Router2 is not showed on R1 now.

R1#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
R3               Eth 0/1            134          R        7206VXR   Fas 0/0