1102.book Page 619 Tuesday, May 20, 2003 2:53 PM
Objectives
Upon completion of this chapter, you will be able to
■ Describe how to implement, monitor, and maintain CDP
■ Understand how to create a network map of the environment
■ Disable and troubleshoot CDP
■ Telnet remotely to other routers
■ Verify, disconnect, and suspend a Telnet connection
■ Perform alternative connectivity tests
1102.book Page 620 Tuesday, May 20, 2003 2:53 PM
Chapter 13
Learning About Neighboring
and Remote Devices
In this chapter, you learn how to implement, monitor, and maintain Cisco Discovery
Protocol by using the correct router commands. In addition, this chapter explains the
commands most often used to perform address-related troubleshooting.
Please be sure to look at the e-Labs, Videos, and PhotoZooms associated with this chapter
that you will find on the CD-ROM accompanying this book. These CD elements are
designed to supplement the material and reinforce the concents introduced in this chapter.
Introduction to CDP
Cisco Discovery Protocol (CDP) is a Layer 2 protocol that connects lower physical media
and upper network layer protocols, as shown in Figure 13-1. CDP is used to obtain infor-
mation about neighboring devices. This information shows the types of devices connected,
the router interfaces they are connected to, the interfaces used to make the connections,
and the model numbers of the devices. CDP is media and protocol independent, and runs
on all Cisco equipment, over the
Subnetwork Access Protocol (SNAP). CDP is a propri-
etary protocol native to Cisco networking devices and will run only on Cisco networking
devices.
CDP Version 2 (CDPv2) is the most recent release of the protocol. Cisco IOS Software
Release 12.0(3)T version or later supports CDPv2. CDP Version 1 (CDPv1) is enabled
globally by default with Cisco IOS Software Release 10.3 or later.
1102.book Page 621 Tuesday, May 20, 2003 2:53 PM
622 Chapter 13: Learning About Neighboring and Remote Devices
Figure 13-1 Where CDP Fits In
When a Cisco device boots up, CDP starts up automatically and allows the device to
detect neighboring devices that are also running CDP. CDP runs over the data link
layer and allows two systems to learn about each other, even if they are using different
network layer protocols.
Each device configured for CDP sends periodic messages, known as advertisements, to
multiple routers. Each device advertises at least one address at which it can receive
Simple Network Management Protocol (SNMP) messages. The advertisements also
contain Time-To-Live (TTL) or holdtime information. This holdtime information indi-
cates the length of time that receiving devices hold CDP information before discarding
it. Additionally, each device listens to periodic CDP messages sent by others to learn
about neighboring devices.
Obtaining Information with CDP
The primary use of CDP is to discover all Cisco devices that are directly connected to a
local device. A CDP frame can be small, yet can retrieve many useful information
about neighboring routers and switches. Use the command show cdp entry [device
name], as demonstrated in Example 13-1, to display a single cached CDP entry.
Example 13-1 show cdp entry Command Output
routerA# show cdp entry routerB
Device ID: routerB
Entry address(es):
1102.book Page 622 Tuesday, May 20, 2003 2:53 PM
Introduction to CDP 623
Notice that the output from this command includes all the Layer 3 addresses present
in the neighbor router, Router B. An administrator can view the IP addresses of the
targeted CDP neighbor (Router B) with the single command entry on Router A. The
holdtime value indicates the amount of elapsed time since the CDP frame arrived with
this information. The show cdp entry [device name] command includes abbreviated
version information about Router B. Knowing the version of neighboring devices
provides you with an idea of the exact physical topology of the network to properly
configure the devices.
Showing CDP Neighbors
Figure 13-2 displays an example of how CDP delivers its collection of information to a
network administrator. Each router that is running CDP exchanges protocol informa-
tion with its neighbors. The network administrator displays the results of this CDP
information exchange on a console that is connected to a local router.
Figure 13-2 CDP Neighbors
IP address: 198.92.68.18
Platform: 2501. Capabilities: Router
Interface: Ethernet), Port ID (outgoing port): Ethernet0
Holdtime: 155 sec
output omitted
Example 13-1 show cdp entry Command Output (Continued)
1102.book Page 623 Tuesday, May 20, 2003 2:53 PM
624 Chapter 13: Learning About Neighboring and Remote Devices
You use the show cdp neighbors command to display information about the networks
directly connected to the router. CDP provides information about each CDP neighbor
device by transmitting Type Length Values (TLVs). TLVs are blocks of information
embedded in CDP advertisements.
Device TLVs displayed by the show cdp neighbors command, and as shown in
Example 13-2, include the following:
■ Device ID
■ Local Interface
■ Holdtime
■ Capability
■ Platform
■ Port ID
■ VTP Management Domain Name (CDPv2 only)
■ Native VLAN (CDPv2 only)
■ Full/Half-Duplex (CDPv2 only)
To display all the information output generated by show cdp neighbors, as well as
information like that from show cdp entry, you use the optional show cdp neighbors
detail command, as demonstrated in Example 13-3.
Example 13-2 show cdp neighbors Command Output
routerA# show cdp neighbors
Capability Codes:
R – Router, T – Trans Bridge,
B – Source Route Bridge,
S – Switch, H – Host, I – IGMP
Device ID Local Interface Holdtime Capability Platform Port ID
routerB Eth 0 151 R 2501 Eth 0
routerB Ser 0 165 R 2501 Ser 0
Example 13-3 show cdp neighbors detail Command Output
routerA# show cdp neighbors detail
Device ID: routerB
Entry address(es):
1102.book Page 624 Tuesday, May 20, 2003 2:53 PM
Introduction to CDP 625
Notice that the lowest router in Figure 13-2 is not directly connected to the adminis-
trator’s console router. To obtain CDP information about this device, the administrator
needs to Telnet to a router that is directly connected to this device. As previously
stated, you will find this information helps you gain full knowledge about the devices
that are on the network, which provides you a better understanding of the physical
topology.
Implementating, Monitoring, and Maintaining CDP Information
The commands in Table 13-1 are used to implement, monitor, and maintain CDP
information.
IP address: 198.92.68.18
Platform: 2501, Capabilities: Router
Interface: Ethernet0, Port ID (outgoing port): Ethernet0
Holdtime: 143 sec
Table 13-1 CDP Commands
Command Mode Description
cdp run Global configuration
mode
Enables CDP globally on the
router.
cdp enable Interface configuration
mode
Enables CDP on an interface.
clear cdp counters Privileged EXEC mode Resets the traffic counters to
zero.
show cdp Privileged EXEC mode Displays the interval between
transmissions of CDP adver-
tisements, the number of
seconds the CDP advertise-
ment is valid for a given
port, and the version of the
advertisement.
show cdp entry
{entry-name [protocol |
version]}
Privileged EXEC mode Displays information about a
specific neighbor. Display can
be limited to protocol or ver-
sion information.
continues
Example 13-3 show cdp neighbors detail Command Output (Continued)
1102.book Page 625 Tuesday, May 20, 2003 2:53 PM
626 Chapter 13: Learning About Neighboring and Remote Devices
Use the cdp run command to enable CDP globally on the router. By default, CDP is
globally enabled. Use the cdp enable command to enable CDP on a particular inter-
face. On Cisco IOS Software Release 10.3 and later, CDP could be enabled on each
interface of the device by using the cdp enable command. Even though CDP is enabled
by default on most Cisco devices, you might encounter instances in which you need to
manually enable CDP on a per interface basis. Examples of when this manual enabling
might need to be done occur on 1900 series switches that do not support using the cdp
run command. On 1900 series switches, you need to enable or disable CDP on a per
interface basis. Other examples include particular interfaces thatmight not have CDP
enabled for security purposes.
Use the show cdp interface command to gather information that CDP uses for its
advertisement and discovery frame transmission. Example 13-4 demonstrates some
sample output from this command. This information helps provide detailed informa-
tion about such things as the holdtime, the frequency at which CDP packets are sent,
the encapsulation time for the interface, and the administrative and protocol condi-
tions of the interface.
show cdp interface
[type number]
Privileged EXEC mode Displays information about
interfaces on which CDP is
enabled.
show cdp neighbors
[type number] [detail]
Privileged EXEC mode Displays the type of device
that has been discovered, the
name of the device, the num-
ber and type of the local
interface (port), the number
of seconds the CDP advertise-
ment is valid for the port, the
device type, the device prod-
uct number, and the port ID.
Issuing the detail keyword
displays information on the
native VLAN ID, the duplex
mode, and the VLAN Trunk-
ing Protocol (VTP) domain
name associated with neigh-
bor devices.
Table 13-1 CDP Commands (Continued)
Command Mode Description
1102.book Page 626 Tuesday, May 20, 2003 2:53 PM
Introduction to CDP 627
Creating a Network Map of the Environment
CDP was designed and implemented as a simple, low-overhead protocol. Though a
CDP frame can be very small, CDP can retrieve a great deal of useful information
about connected neighboring routers.
The show cdp neighbors command can be used to obtain the following information:
■ Device ID
■ Address
■ Port ID
■ Capabilities
■ Version
■ Platform
■ IP Network Prefix
■ VTP Management Domain Name (CDPv2 only)
■ Native VLAN (CDPv2 only)
■ Full/Half-Duplex (CDPv2 only)
This information can be used to create a network map of the connected devices. Devices
connected to neighboring devices can be discovered by using Telnet to connect to the
neighbors. Use the show cdp neighbors detail command to discover what devices are
connected to those neighbors.
Disabling and Troubleshooting CDP
As previously mentioned, CDP is globally enabled on the router by default. To disable
CDP at the global level, use the no cdp run command in global config mode. If CDP
is disabled globally, the interface cannot be enabled for CDP. For example, you might
disable CDP for security purposes when you do not want information made available
about a particular device.
Example 13-4 show cdp interface Command Output
routerA# show cdp interface
Serial 0 is up, line protocol is up, encapsulation is Frame Relay
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
Ethernet0 is up, line protocol is up, encapsulation is ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
1102.book Page 627 Tuesday, May 20, 2003 2:53 PM
628 Chapter 13: Learning About Neighboring and Remote Devices
On Cisco IOS Software Release 10.3 and later, CDP is disabled by default on each of
interface of the device. You must use the cdp enable command before CDP is enabled
and CDP messages can be sent and received. To disable CDP on a specific interface
after it has been enabled, use the no cdp enable command in interface config mode.
Table 13-2 lists and describes troubleshooting commands that you can use to show the
version, update information, tables, and traffic.
Table 13-2 CDP Troubleshooting Commands
Command Description
clear cdp table Deletes the CDP table of information about neighbors.
clear cdp counters Resets the traffic counters to zero.
show cdp traffic Displays CDP counters, including the number of packets
sent and received and checksum errors.
show debugging Displays information about the types of debugging that are
enabled for your router.
debug cdp adjacency Displays information about CDP neighbors.
debug cdp events Displays information about CDP events.
debug cdp ip Displays information about CDP IP information.
debug cdp packets Displays information about CDP packet-related information.
cdp timers Specifies how often Cisco IOS Software sends CDP updates.
cdp holdtime Specifies the holdtime the receiving device should hold a
CDP packet from your router before discarding.
show cdp Displays information about CDP update packets.
Lab Activity Creating a Network Map Using CDP
In this activity, you use the CDP commands to get information about neighbor-
ing networks and routers.
Lab Activity CDP Neighbors
In this activity, you use the CDP commands to get information about neighbor-
ing networks and routers. You display information on how CDP is configured
for its advertisement and discovery frame transmission.
1102.book Page 628 Tuesday, May 20, 2003 2:53 PM