The show cdp nei command displays information about directly connected Cisco devices using the Cisco Discovery Protocol (CDP). It reveals device names, interface types, IP addresses, and platform details for adjacent network equipment.
CDP is a Layer 2 protocol built into Cisco devices. It operates without requiring configuration changes on neighboring devices. When enabled, each device broadcasts CDP packets every 60 seconds, allowing peers to learn about each other's presence and capabilities.
Running show cdp nei on a Cisco switch or router returns a list of discovered neighbors. This output includes the neighbor's device name, local interface, remote interface, platform type, and capabilities. The command is essential for network diagnostics, asset inventory, and troubleshooting physical layer issues.
When a Cisco device sends a CDP packet, it includes fields such as device ID, platform, capabilities, and hold time. Neighboring devices receive these packets and store the information in a cache. The show cdp nei command queries this cache and formats the data for display.
Each entry appears in a tabular format with columns: Device ID, Local Interface, Holdtime, Capability, Platform, and Remote Interface. For example:
Device ID Local Intrfce Holdtme Capability Platform Remote Intrfce
R1 Gig 0/0 155 R S I 2911 Gig 0/0
SW1 Fa 0/1 120 S WS-C2960 Fa 0/2
Holdtime indicates how long the device expects to remain reachable. If no update is received within this period, the neighbor entry is removed. Capability flags show what functions the device supports: R (router), S (switch), I (IGRP capable), etc.
CDP runs automatically on most Cisco interfaces unless disabled with no cdp enable. It does not require IP addressing to function-CDP operates at the data link layer, so it works even on unconfigured ports.
CDP information varies based on the device type and configuration. The following table outlines typical values seen in show cdp nei output.
| Field | Meaning | Example Value |
|---|---|---|
| Device ID | Hostname or model name of the neighbor | R1, SW1, ASR1001-X |
| Local Interface | Port on the local device | GigabitEthernet0/0, FastEthernet0/1 |
| Holdtime | Seconds until the neighbor is marked unreachable | 155, 120 |
| Capability | Functions supported by the neighbor | Router (R), Switch (S), Host (H) |
| Platform | Hardware model and series | 2911, WS-C2960, ISR4321 |
| Remote Interface | Port on the neighbor device | GigabitEthernet0/0, FastEthernet0/2 |
Some devices may not report a Device ID if they're running a minimal configuration or have CDP disabled. In such cases, the field shows "unknown" or remains blank.
A non-obvious detail: CDP does not provide VLAN information. While the output shows the interface, it doesn't reveal whether the port is in access or trunk mode. You must run show interfaces or show vlan separately to confirm VLAN context.
Network engineers use show cdp nei to verify physical connections, map network topology, and validate device placement. It's especially useful during outages when IP reachability fails but physical connectivity is suspected.
For example, during a site-wide outage, a technician ran show cdp nei on a core switch and saw that a distribution switch was missing from the output. Further inspection revealed a loose fiber cable. Reconnecting the cable restored CDP adjacency and resolved the issue.
Many assume CDP provides routing information or allows inter-VLAN communication. This is incorrect. CDP only discovers direct neighbors. It does not route traffic or exchange routing tables. It's purely for discovery and diagnostics.
Another misconception: CDP is secure. It is not. CDP packets are sent in plaintext and can be intercepted. They expose device names, models, and interfaces. For this reason, disable CDP on untrusted segments using no cdp run or cdp disable on specific interfaces.
To see more detailed information, use show cdp nei detail. This version includes the neighbor's IP address, software version, and uptime. It's helpful when verifying compatibility between devices.
If show cdp nei returns no output despite physical connectivity, check the following:
show cdp confirms status).I once encountered a case where a new access switch failed to appear in CDP output. After checking, we found the port was set to switchport mode access but had no IP assigned. CDP still worked, but the switch wasn't responding to requests. Rebooting the switch cleared the cache and restored CDP visibility.
For deeper analysis, combine show cdp nei with show interfaces and show ip interface brief. These commands together confirm whether a port is up, has an IP, and is actively exchanging CDP data.
Use show cdp neighbors for the same output as show cdp nei. Both are equivalent syntaxes. The abbreviated form sh cdp nei is common in scripts and automation.
To disable CDP globally, enter no cdp run in global configuration mode. To disable it on a single interface, use no cdp enable under the interface.
For monitoring timers and CDP behavior, run show cdp interface to see which interfaces are sending and receiving CDP updates. This helps detect misconfigurations or interface flapping.
Understanding show cdp nei is important for maintaining accurate network maps and diagnosing connection issues. It's a lightweight, fast way to verify neighbor relationships without relying on IP reachability.
Always remember: CDP is not a substitute for proper documentation or network management tools. But as a quick diagnostic tool, it delivers immediate insight into physical and logical device adjacency.