Lab 13 – Cisco Discovery Protocol (CDP)



Goal:
Demonstrate Cisco Discovery Protocol
Configure Cisco Discovery Protocol

Requirements:

● Switches labsw1, labsw1
● 1 PC with COM port, Ethernet port optional
● Cisco rollover cable
● 1 Ethernet cables - optioinal
● 1 Ethernet crossover cable

In this lab, labsw2, interface Fa0/21, will be used as the trunk port connected to labsw1, interface Fa0/24. The reason for the change is to reduce confusion in displays for this lab. Note the change in the diagram above.

Cisco Discovery Protocol (CDP) is a proprietary protocol developed by Cisco to assist with troubleshooting, and it is a great troubleshooting tool. A Cisco switch or router communicates specific information with any other Cisco device that it is connected to. CDP is a Layer 2 protocol, which means it does not require IP to function. In fact, two routers that are configured incorrectly, and therefore will never pass user data without being re-configured, can communicate certain types of system or device information with an attached Cisco device. Network techs regularly use cdp to identify problems with configuration.

Cisco Discovery Protocol runs automatically on all Cisco devices, which means it is part of the default, “out-of-the-box” configuration. cdp must be turned off if it is not wanted. The default configuration can be viewed by using the “show cdp” command.
1. labsw1#show cdp
Switch#show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled


The first parameter is self-explanatory: cdp packets are sent on active interfaces every 60 seconds. The holdtime value needs explanation. Cisco uses hold timers for a number of functions, and their purpose is usually the same. A holdtime value is the amount of time that can elapse without an update before the connection is declared down.

In the case of the default CDP configuration, each device sends a cdp packet every 60 seconds. Sort of. There are reasons that a cdp packet will not be sent. One of them would be that “real” data, user data, has priority over cdp data, and it will delay the cdp packet when “real” data needs to be sent. However, it is more likely that a missed cdp packet will be the result of an error in the network. Which is where the holdtime value comes in. In this case, if a cdp packet is not received in 180 seconds, or three times the cdp value, the cdp cache will be flushed for that interface.

The real value of cdp is found in the following commands:
show cdp neighbor
show cdp neighbor detail
show cdp neighbor fa0/x
(or active interface) (not available on Packet Tracer)
show cdp neighbor fa0/x detail
(or active interface) (not available on Packet Tracer)

These commands will display information about an attached, or neighboring, Cisco device.

1. labsw1# show cdp neighbor
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       124     S I       WS-C2950-2Fas 0/21

  • “Capability Code” shows the device types available for display.

  • “Device ID” is the hostname of the remote device. In this case, labsw2 is the remote device to labsw1.

  • “Local interface” is the interface on the local device that is receiving cdp packets. In this case, it is Fa0/24, on labsw1.

  • “Holdtme” is the amount of time before the cdp connection is declared down. In this example, 124 seconds remain before the connection is declared down, which means that 56 seconds have elapsed since the last cdp packet was recieved. This value is reset to 180 seconds each time a cdp packet is received. Examples are provided below.

  • “Capability” is the device type, based on the codes shown in Capability Codes: “S” indicates that it is a switch, “I” indicates IGMP.

  • “Platform” indicates the model of the device. labsw2 is a 2950 switch: WS-C2950.

  • “Port ID” is the port on the remote device that supports the connection. Interface Fa0/21 is the interface on labsw2 that connects to labsw1.

As indicated in the Holdtime value (124), the value is reset whenever a cdp packet is received. The examples below are taken from labsw1 and show the value change as cdp packets are received:
labsw1#sho cdp neighbor
labsw1# show cdp neighbor
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       133     S I       WS-C2950-2Fas 0/21

labsw1#sho cdp neighbor
labsw1# show cdp neighbor
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       126     S I       WS-C2950-2Fas 0/21

labsw1#sho cdp neighbor
labsw1# show cdp neighbor
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       122     S I       WS-C2950-2Fas 0/21

labsw1#sho cdp neighbor
labsw1# show cdp neighbor
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       177     S I       WS-C2950-2Fas 0/21


In the display above, labsw2 is connected to labsw1. The Holdtime value counts down (133 seconds, 126 seconds, 122 seconds) before a cdp packet is reset. When the packet is received, the timer resets to 180, and begins the count down again (177).

Significantly more information about the remote device is available with the “show cdp neighbor detail” display:

2. labsw1#sho cdp neighbor detail
-------------------------
Device ID: labsw2
Entry address(es):
IP address: 192.168.0.76
Platform: cisco WS-C2950-24, Capabilities: Switch IGMP
Interface: FastEthernet0/24, Port ID (outgoing port): FastEthernet0/21
Holdtime : 127 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA6, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Fri 21-Oct-05 02:22 by yenanh

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF000000000000000A8AE65180FF0000
VTP Management Domain: 'tlbeh'
Native VLAN: 1
Duplex: full
Management address(es):
IP address: 192.168.0.76


Much of the information shown above is easily understood. labsw2 was configured with an IP address of 192.168.1.76 for VLAN 1. The device name, device type, connected ports (Fa0/24, Fa0/21) were seen in the previous display. Other information, such as the IOS version, has been seen in previous labs. Some information, such as Native VLAN and VTP Management Domain, has not yet been covered in these labs, but is important for managing a network. However, it should obvious that the Detail command contains more detail.

In an enterprise network, it is common for a switch or router to have dozens of devices connected to it. The commands above will show the information for all of those devices. In an imaginary network where labsw1 is connected to a dozen devices, the display would be something like
labsw1#sho cdp neighbor
labsw1# show cdp neighbor
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       124     S I       WS-C2950-2Fas 0/21
labsw3     Fas 0/23       124     S I       WS-C2950-2Fas 0/24
labsw4     Fas 0/22       124     S I       WS-C2950-2Fas 0/23
labsw5     Fas 0/21       124     S I       WS-C2950-2Fas 0/24
labsw6     Fas 0/20       124     S I       WS-C2950-2Fas 0/23
labsw7     Fas 0/19       124     S I       WS-C2950-2Fas 0/21
labsw8     Fas 0/18       124     S I       WS-C2950-2Fas 0/24
labsw9     Fas 0/17       124     S I       WS-C2950-2Fas 0/23
labsw10    Fas 0/16       124     S I       WS-C2950-2Fas 0/21

etc.

These displays can get very long and take a while to search for the needed information. If the “show cdp neighbor detail” command was used, the full detail display for all devices would be displayed. That can be a lot of data to sift through.

To display the information on a single interface such as Fa0/24, use “show cdp neighbor fa0/24

labsw1#sho cdp neighbor fa0/24
Capability Codes: R-Router, T-Trans Bridge, B-Sce Rte Brdge
S-Switch, H-Host, I-IGMP, r-Repeater, P-Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
labsw2     Fas 0/24       124     S I       WS-C2950-2Fas 0/21


The display will be limited to the specified interface: Fa0/24.

This is even more valuable when using the detail command in a large network. The display will be only for the specified interface and not the entire switch:

labsw1#sho cdp neighbor fa0/24 detail
-------------------------
Device ID: labsw2
Entry address(es):
IP address: 192.168.0.76
Platform: cisco WS-C2950-24, Capabilities: Switch IGMP
Interface: FastEthernet0/24, Port ID (outgoing port): FastEthernet0/21
Holdtime : 121 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA6, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Fri 21-Oct-05 02:22 by yenanh

advertisement version: 2
Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF000000000000000A8AE65180FF0000
VTP Management Domain: 'tlbeh'
Native VLAN: 1
Duplex: full
Management address(es):
IP address: 192.168.0.76


It is possible to change the cdp timing parameters. To change the cdp timer:

labsw1(config)#cdp timer x
(number of seconds between cdp packets)

The default holdtime is 3 times the cdp packet timer. If 30 seconds was configured for the cdp timer, the hold time would be 90 seconds. However, this can also be changed:
labsw1(config)#cdp holdtime x
(number of seconds for the hold time)

If the timers are changed, they should be changed on both connecting devices. The only reason for changing cdp timers is to reduce network traffic.

cdp timers are rarely changed. It is more common to disable cdp. There are two reasons for disabling cdp:
1. If the device is not connected to another Cisco device: a standalone switch, for example. Disabling cdp prevents the cdp transmission on the active interfaces. Similarly, cdp may be disabled on interfaces that do not connect to Cisco devices. This will insure that cdp is available on the interfaces that support other Cisco devices.
2. If you are connecting to a customer network, you may not want the customer to be able to gather information about your network from cdp advertisements.

To disable cdp:

labsw1(config)#no cdp run


This configuration disables all cdp for the Cisco device.

It is more common to disable cdp on the interface that connects to the customer network, and keep cdp enabled on the connections to your network. To disable cdp on an interface, enter interface configuration mode for the interface and disable cdp on the interface:



labsw1(config)#int fa0/24
labsw1(config-if)#no cdp enable


cpd is a valuable tool for network management, and it is a likely test question.