VMware ESXi and vSphere Cluster Management

Use Cisco Discovery Protocol (CDP) to Identify Directly Connected Devices

Learn how Cisco Discovery Protocol works and how to use show cdp neighbors commands to identify directly connected routers and switches.

Cisco Discovery Protocol (CDP) is a Cisco proprietary Layer 2 neighbor-discovery protocol. It allows a Cisco router, switch, or other supported device to exchange identification information with devices directly attached to its interfaces.

CDP is useful when you need to discover a network topology, document cabling, verify interface connections, or troubleshoot an unexpected physical connection. The most important limitation is that CDP identifies only the adjacent device on a local link. It does not discover devices several switches or routers away.

What CDP Does

A CDP neighbor is a directly connected device from which a CDP advertisement has been received. A device periodically sends discovery advertisements through CDP-enabled interfaces. The receiving device stores the information in a local neighbor table.

Because CDP operates at the data-link layer, the two devices do not need end-to-end IP connectivity for CDP information to be learned. The devices must, however, be connected through the same directly attached network link and support or permit CDP.

A CDP advertisement can provide information such as:

  • The remote device identity, commonly its configured hostname
  • Address information, such as a management or protocol address
  • The local interface that received the advertisement
  • The remote interface that sent the advertisement
  • The hardware platform
  • Device capabilities, such as routing or switching
  • Software or IOS version information
  • Duplex information where the platform and software provide it

Common Uses for CDP

  • Topology discovery: Determine which Cisco device is attached to each local interface.
  • Network documentation: Record device names, platforms, and interface-to-interface connections.
  • Interface verification: Confirm that a cable connects the expected local port to the expected remote port.
  • Troubleshooting: Investigate a missing neighbor, an incorrect cable connection, or a topology that differs from documentation.

Viewing the CDP Neighbor Summary

From privileged EXEC mode, use the following command to display a summary of directly connected CDP neighbors:

show cdp neighbors

The output provides one row for each learned neighbor. To identify a device attached to an unknown switch port, locate the relevant value in the Local Interface column. Then read across the row to find the neighboring device in Device ID, its hardware platform in Platform, and the interface it used in Port ID.

Device ID        Local Interface    Holdtime    Capability    Platform    Port ID
SW-ACCESS        Gig 1/0/1          142         S             ...         Gig 1/0/24
R-EDGE           Gig 1/0/24          128         R             ...         Gig 0/0

In this example, the local interface Gig 1/0/1 is connected to the remote switch interface Gig 1/0/24. The local interface Gig 1/0/24 is connected to the remote router interface Gig 0/0.

Interpreting show cdp neighbors Output

Output fieldWhat it identifiesHow it is used
Device IDThe identifying name of the remote neighbor, commonly its configured hostname.Match the local port to a specific neighboring device.
Local InterfaceThe interface on the current device that received the CDP advertisement.Find the local physical or logical interface connected to the neighbor.
HoldtimeThe remaining lifetime, in seconds, of the learned neighbor entry if no refreshed advertisement arrives.Understand how long the entry can remain after advertisements stop.
CapabilityA code describing functions supported by the neighboring device.Recognize whether the neighbor can perform functions such as routing or switching.
PlatformThe remote hardware platform and related software identification shown by CDP.Identify or verify the model and device type.
Port IDThe interface on the neighboring device that sent the CDP advertisement.Identify the remote end of the local-to-remote link.

Device ID

Device ID is the name or identifier of the neighboring device. It is commonly the remote device's hostname, but the displayed value depends on how that platform identifies itself. If hostnames are inaccurate or outdated, the Device ID may not match your documentation.

Local Interface and Port ID

Local Interface belongs to the device where you run the command. Port ID belongs to the neighboring device. Together, they describe both ends of the connection.

For example, if the output reports Local Interface: Gig 1/0/5 and Port ID: Gig 0/1, the local device's Gig 1/0/5 should be connected to the neighbor's Gig 0/1. This mapping is useful for tracing cables and comparing the actual topology with a diagram.

Holdtime

Holdtime is the number of seconds remaining before the local device removes a learned neighbor entry if it does not receive another CDP advertisement. A changing or decreasing holdtime is normal. If advertisements stop because of a link failure, reload, or CDP configuration change, the entry eventually expires.

Capability

The Capability column contains abbreviations. Common examples include:

CodeGeneral meaningExample interpretation
RRouting capabilityThe neighbor can operate as a router or perform Layer 3 routing functions.
SSwitching capabilityThe neighbor can operate as a network switch or perform switching functions.

A device may advertise more than one capability. Interpret the codes as general device functions rather than as a complete description of every feature enabled on the neighbor.

Platform

Platform identifies the remote hardware model and associated software context reported by CDP. This can help distinguish a switch from a router, verify that the expected device is attached, and identify a platform when labels or documentation are incomplete.

Viewing Detailed CDP Information

The summary is useful for quickly mapping interfaces, but it omits many details. Use the detailed command to display expanded information for directly connected neighbors:

show cdp neighbors detail

Detailed output can include the neighbor identifier, protocol or management address, platform, software or IOS version information, capabilities, local and remote interface association, and duplex information where available. This makes the command useful for documentation and for investigating whether the discovered device is the one expected.

A practical documentation workflow is:

  1. Run show cdp neighbors to list adjacent devices and map interfaces quickly.
  2. Run show cdp neighbors detail to collect expanded identity, address, platform, software, and capability information.
  3. Record the local interface and remote Port ID as a pair in the topology documentation.
  4. Compare the result with the planned topology and investigate any mismatch.

Practical CDP Examples

Identify the Device Attached to an Unknown Switch Port

  1. Run show cdp neighbors on the switch.
  2. Locate the desired value in the Local Interface column.
  3. Read the Device ID, Platform, and Port ID values on that row.
  4. Use the local-interface and remote-port pair to document the connection.

The result maps a local switch port to a neighboring Cisco device and identifies the remote interface connected to it.

Confirm a Router-to-Switch Connection

  1. Run show cdp neighbors on the router.
  2. Find the expected switch in the Device ID column.
  3. Verify that the capability includes switching, commonly shown with S.
  4. Compare the router's Local Interface with the switch interface shown in Port ID.

This confirms the expected device type and identifies the exact interfaces used by the connection.

Collect Details for Documentation or Troubleshooting

  1. Run show cdp neighbors detail.
  2. Record the neighbor identifier, platform, software information, address information, capabilities, and interface mapping.
  3. Use the values to update a topology diagram or investigate a connection that does not match the design.

CDP Capabilities and Limitations

  • CDP is Cisco proprietary and is primarily intended for use between Cisco devices.
  • CDP operates at Layer 2, so it does not depend on end-to-end IP connectivity.
  • CDP discovers only directly connected neighbors, not devices beyond the immediate link.
  • A missing CDP entry does not prove that a cable or device is absent. CDP may be disabled, unsupported, or not yet refreshed.
  • CDP information describes what the adjacent device advertises; it does not replace physical link checks or complete interface troubleshooting.

CDP Versus LLDP

Link Layer Discovery Protocol (LLDP) is an IEEE standards-based, vendor-neutral alternative to CDP. CDP is Cisco-specific, while LLDP is designed to allow compatible devices from different vendors to exchange discovery information.

CharacteristicCDPLLDP
Protocol ownershipCisco proprietary.IEEE standards-based.
Typical device interoperabilityBest suited to Cisco-to-Cisco discovery.Supports discovery across multiple vendors when implemented and enabled.
Discovery scopeDirectly connected neighbors only.Directly connected neighbors only.
Appropriate use caseCisco-centric networks and Cisco device troubleshooting.Multi-vendor networks requiring a common discovery protocol.

Use LLDP when the adjacent device is from another vendor or when the network standard requires vendor-neutral discovery. Do not expect CDP to reveal a non-Cisco neighbor unless that device specifically supports CDP.

Troubleshooting Missing or Unexpected Neighbors

The Expected Adjacent Device Does Not Appear

Possible causes include:

  • The device is not directly connected.
  • The physical connection is down or is connected to a different interface than expected.
  • CDP is disabled on one or both ends.
  • The neighboring platform does not support CDP.
  • The local device has not yet received a valid CDP advertisement.

First verify the local interface and physical link state. Confirm that the expected device is directly attached, check whether its platform supports CDP, and use LLDP when vendor-neutral discovery is appropriate.

The Neighbor Entry Disappears

An entry can disappear when no refreshed CDP advertisements arrive before the holdtime expires. A link-state change, device reload, disconnection, or CDP being disabled on the neighbor can produce the same symptom.

Review the Holdtime value, check the local link and cabling, and confirm that the neighbor is still operating and connected to the expected port.

The Discovered Device Does Not Match the Topology

A cable may be connected to the wrong switch port, a hostname may be inaccurate, or the documentation may be outdated. Compare Local Interface and Port ID with the topology diagram. Then use show cdp neighbors detail to verify platform and address information before correcting cabling, device naming, or documentation.

Key Takeaways

  • CDP is a Cisco proprietary Layer 2 protocol for discovering directly connected devices.
  • show cdp neighbors provides a concise interface-to-interface neighbor map.
  • show cdp neighbors detail provides expanded identity, address, platform, software, capability, and interface information.
  • Local Interface identifies the interface on the current device; Port ID identifies the remote interface.
  • Holdtime controls how long a learned entry remains without refreshed advertisements.
  • CDP cannot discover devices beyond the immediate neighbor and may not show unsupported or CDP-disabled devices.
  • LLDP is the preferred standards-based alternative in many multi-vendor environments.