CDP and show cdp neighbors – Cisco Device Discovery Protocol
1. What Is CDP?
CDP (Cisco Discovery Protocol) is a Cisco-proprietary Layer 2 protocol that enables Cisco devices — routers, switches, IP phones, access points — to automatically advertise themselves to directly connected neighbours. Because CDP operates at Layer 2, it works entirely independently of IP addressing: a Cisco device with no IP configured at all can still send and receive CDP advertisements, making it invaluable during initial device bring-up, cabling verification, and troubleshooting before routing is established.
CDP is enabled by default on all Cisco IOS devices. Devices
send CDP updates as multicast frames every 60 seconds (the
CDP advertisement timer) to the multicast MAC address
0100.0CCC.CCCC. Each advertisement carries a
holdtime (default 180 seconds — three times the advertisement
interval) that tells neighbours how long to keep the information
before discarding it if no new advertisement arrives.
CDP operation — Layer 2 only:
[Switch A] ─────── CDP frame (tagged VLAN, L2 multicast) ────── [Switch B]
[Switch A] ──────────────────────────────────────────────────── [Router R1]
CDP works even if:
- Interfaces have no IP addresses configured
- Routing protocols are not running
- The device has just been factory-reset
CDP does NOT cross routers — only directly connected (one hop) devices appear.
Related pages: show interfaces | show ip interface brief | show ip route | OSI Layer Functions | show mac-address-table | OSPF Overview | VLANs
2. show cdp neighbors — Output Field by Field
show cdp neighbors (run from privileged EXEC mode)
produces a compact one-line-per-neighbour summary table. This
is the command to reach for first when verifying physical
connectivity or building a topology map.
Switch# show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
D - Remote, C - CVTA, M - Two-port Mac Relay
Device ID Local Intrfce Holdtme Capability Platform Port ID
SwitchB Gig 0/1 122 S I WS-C2960 Gig 0/2
RouterA Gig 0/2 132 R S I ISR4331 Gig 0/0
IPPhone1 Gig 0/3 170 P CP-7960 Port 1
│ │ │ │ │ │
Device ID Local Interface Holdtime Capability Platform Port ID
(neighbour (MY port that (seconds (device (hardware (neighbour's
hostname) connects to until type) model) port facing
neighbour) discarded) me)
| Field | Description | Example | Notes |
|---|---|---|---|
| Device ID | The hostname of the neighbouring device as configured
by its hostname command |
SwitchB |
If the neighbour has no hostname set, the MAC address may appear instead |
| Local Intrfce | The interface on your local device that the CDP advertisement arrived on — the port facing the neighbour | Gig 0/1 |
Abbreviated: Gig = GigabitEthernet, Fas = FastEthernet, Ser = Serial |
| Holdtme | Countdown timer in seconds — how long the entry will be kept if no new CDP advertisement arrives from that neighbour | 122 |
Default starts at 180s (3× the 60s advertisement interval); a rapidly decrementing value may indicate a slow or unstable link |
| Capability | One or more letters indicating the type(s) of device the neighbour is configured as | R S I |
R=Router, S=Switch, T=Trans Bridge, B=Source Route Bridge, H=Host, I=IGMP, r=Repeater, P=Phone, D=Remote, C=CVTA |
| Platform | The hardware model/platform string of the neighbour device as it identifies itself | WS-C2960 |
Useful for identifying exact hardware models; an attacker could also use this to target known vulnerabilities |
| Port ID | The interface on the neighbour device that connects to you — the remote end of the cable | Gig 0/2 |
Combined with Local Intrfce, this gives the complete cable mapping: my Gi0/1 ↔ SwitchB Gi0/2 |
3. show cdp neighbors detail — Extended Output
show cdp neighbors detail adds IP address, IOS
version, serial number, duplex, and management VLAN information
that does not appear in the basic command. This is the command
to use when you need to build a complete inventory or
remotely manage a device you cannot directly log into.
Switch# show cdp neighbors detail
-------------------------
Device ID: SwitchB
Entry address(es):
IP address: 10.1.1.2 ← management IP (use this to SSH/Telnet in)
Platform: cisco WS-C2960, Capabilities: Switch IGMP
Interface: GigabitEthernet0/1, Port ID (outgoing port): GigabitEthernet0/2
Holdtime : 133 sec
Version :
Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(2)SE5
... ← exact IOS version (useful for patching)
advertisement version: 2 ← running CDPv2
VTP Management Domain: '' ← VTP domain name
Native VLAN: 1 ← native VLAN on the trunk link
Duplex: full ← duplex mismatch would appear here
Management address(es):
IP address: 10.1.1.2
! Field explanations:
! Entry address(es) / Management address → IP to reach this device
! Platform → exact hardware model
! Version → full IOS version string
! advertisement version → CDPv1 or CDPv2
! VTP Management Domain → VTP domain (useful for VTP troubleshooting)
! Native VLAN → trunk native VLAN (mismatch causes issues)
! Duplex → speed/duplex (mismatch = slow/errors)
You can target a specific neighbour by name:
show cdp entry SwitchB — displays the same
detail output for only that device.
4. All CDP Commands — Reference Table
| Command | Mode | Purpose | Key Information Shown |
|---|---|---|---|
show cdp neighbors |
Privileged EXEC | Summary list of all directly connected CDP neighbours | Device ID, Local Interface, Holdtime, Capability, Platform, Port ID |
show cdp neighbors detail |
Privileged EXEC | Full details on all neighbours | All summary fields plus IP address, IOS version, serial number, duplex, native VLAN, VTP domain, management address |
show cdp entry <device-id> |
Privileged EXEC | Full detail for one specific neighbour | Same as detail but filtered to one device |
show cdp |
Privileged EXEC | Global CDP status and timers | CDP enabled/disabled, advertisement interval (60s), holdtime (180s), CDPv2 advertisements enabled/disabled |
show cdp interface |
Privileged EXEC | CDP status on every interface | Which interfaces have CDP enabled/disabled; per-interface advertisement and holdtime timers |
show cdp traffic |
Privileged EXEC | CDP packet statistics | Total CDP packets sent, received, errors — useful for diagnosing CDP advertisement problems |
5. CDPv1 vs CDPv2
| Feature | CDPv1 | CDPv2 |
|---|---|---|
| Basic device discovery | Yes | Yes |
| Native VLAN information | No | Yes — detects native VLAN mismatches between trunk peers and logs a warning |
| Duplex information | No | Yes — detects duplex mismatches between neighbours |
| VLAN-Trunking Protocol (VTP) domain | No | Yes |
| Power over Ethernet (PoE) | No | Yes — carries power requirements for IP phones and access points |
| Default on modern Cisco IOS | No | Yes — CDPv2 is the default; use
no cdp advertise-v2 to revert to v1 |
6. Enabling and Disabling CDP
CDP must sometimes be disabled for security — particularly on access ports facing end users and on interfaces connected to the internet or third-party networks. CDP can be disabled at two levels: globally (across the entire device) or per-interface (selective control).
Global Enable / Disable
! Disable CDP on the entire device:
Switch(config)# no cdp run
! Re-enable CDP globally:
Switch(config)# cdp run
! Verify global CDP status:
Switch# show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled
Per-Interface Enable / Disable
! Disable CDP on a specific interface (access port to end user):
Switch(config)# interface GigabitEthernet0/2
Switch(config-if)# no cdp enable
! Re-enable CDP on that interface:
Switch(config)# interface GigabitEthernet0/2
Switch(config-if)# cdp enable
! View CDP status per interface:
Switch# show cdp interface GigabitEthernet0/1
GigabitEthernet0/1 is up, line protocol is up
Encapsulation ARPA
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
! Compare: an interface with CDP disabled:
Switch# show cdp interface GigabitEthernet0/2
% CDP is not enabled on GigabitEthernet0/2
Adjust CDP Timers (Advanced)
! Change the CDP advertisement interval (default 60 seconds):
Switch(config)# cdp timer 30 ! send updates every 30 seconds
! Change the holdtime (default 180 seconds = 3× timer):
Switch(config)# cdp holdtime 90 ! keep neighbour info for 90 seconds
! Note: holdtime should always be greater than the timer to prevent
! neighbours from disappearing between updates on slow links.
7. CDP vs LLDP
LLDP (Link Layer Discovery Protocol) is the IEEE 802.1AB vendor-neutral equivalent of CDP. While CDP only works between Cisco devices, LLDP works between any vendor's equipment that supports the standard — Cisco, HP, Juniper, Aruba, etc. In multi-vendor networks, LLDP is the correct tool.
| Feature | CDP | LLDP |
|---|---|---|
| Standard | Cisco proprietary | IEEE 802.1AB (vendor-neutral) |
| OSI Layer | Layer 2 | Layer 2 |
| Enabled by default | Yes (all Cisco IOS devices) | No — must be enabled manually with
lldp run |
| Device compatibility | Cisco devices only | Any IEEE 802.1AB-compliant device |
| Summary command | show cdp neighbors |
show lldp neighbors |
| Detail command | show cdp neighbors detail |
show lldp neighbors detail |
| Per-interface enable | cdp enable /
no cdp enable |
lldp transmit /
lldp receive (separate TX/RX control) |
| Global enable/disable | cdp run /
no cdp run |
lldp run /
no lldp run |
| Advertisement multicast MAC | 0100.0CCC.CCCC | 0180.C200.000E |
| Security risk | Topology and hardware info exposed to connected devices | Same — topology and hardware info exposed |
| Best used for | Cisco-only environments; labs; initial device bring-up and documentation | Multi-vendor production networks; environments with non-Cisco equipment |
LLDP Configuration on Cisco IOS
! Enable LLDP globally (disabled by default):
Switch(config)# lldp run
! LLDP per-interface granular control (separate TX and RX):
Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# lldp transmit ! send LLDP advertisements out
Switch(config-if)# lldp receive ! process received LLDP advertisements
! Disable LLDP on a specific interface:
Switch(config-if)# no lldp transmit
Switch(config-if)# no lldp receive
! Verify LLDP neighbours:
Switch# show lldp neighbors
Switch# show lldp neighbors detail
8. Security Considerations
CDP is a powerful troubleshooting tool — but it exposes significant information to anyone connected to a switch port. A CDP frame from a switch reveals: the switch's hostname, model number (Platform field), IOS version, management IP address, native VLAN, and the exact interface names. An attacker with physical access to a port or a compromised end-point can read all of this with a standard packet capture.
| Risk | What CDP Reveals | Mitigation |
|---|---|---|
| Hardware reconnaissance | Platform field reveals exact model (e.g., WS-C2960X) — attackers can look up known vulnerabilities for that specific hardware/software combination | Disable CDP on all untrusted, user-facing, and
internet-connected interfaces with
no cdp enable |
| Topology mapping | Device ID and Port ID fields reveal the exact physical topology — which devices connect on which ports; an attacker can reconstruct the entire network map | Disable CDP on access ports; restrict physical access to switch ports; use 802.1X port authentication |
| Management IP exposure | show cdp neighbors detail output reveals
the management IP — the address used to SSH/Telnet into
the device; facilitates targeted management plane
attacks |
Apply management ACLs restricting who can reach the management IP; use access-class on VTY lines |
| IOS version disclosure | CDP detail output includes the exact IOS version string; known CVEs exist for specific IOS versions and attackers actively target unpatched devices | Keep IOS up to date; disable CDP on internet-facing and untrusted interfaces |
| Native VLAN information | CDPv2 advertises the native VLAN; this information can assist VLAN hopping attacks on trunk links | Change native VLAN from the default VLAN 1; disable CDP on trunk ports facing untrusted networks |
Security Best Practice — CDP Policy
Enable CDP on:
✓ Trunk links between trusted Cisco switches and routers
✓ Links between infrastructure devices (core–distribution–access)
✓ Links to trusted management segments
Disable CDP on:
✗ Access ports connected to end users (PCs, workstations)
✗ Ports connected to servers (unless Cisco IP phones are inline)
✗ Any interface connected to the internet or DMZ
✗ Ports in public areas or connected to third-party equipment
Example — disable CDP on all access ports in a range:
Switch(config)# interface range GigabitEthernet0/1 - 24
Switch(config-if-range)# no cdp enable
See: Named ACLs | Applying ACLs | ACL Overview
9. Troubleshooting with CDP
CDP is often the fastest way to identify cabling and connectivity problems in a Cisco network because it provides ground-truth physical connectivity information independent of IP configuration.
| Symptom | CDP Diagnostic Approach | Likely Cause if CDP Confirms Issue |
|---|---|---|
Expected neighbour does not appear in
show cdp neighbors |
Check physical link with
show interfaces status — is the port
connected and up? Check CDP status on both ends with
show cdp interface <int> |
Wrong cable or wrong port; CDP disabled on one end
(no cdp enable or no cdp run);
interface shutdown; neighbour is a non-Cisco device
(CDP would not show it — use LLDP instead) |
| Neighbour shown but connectivity failing | Run show cdp neighbors detail — check
native VLAN and duplex fields; compare against
expected values |
Native VLAN mismatch (CDPv2 will log a warning); duplex mismatch causing half-duplex collisions and slow performance |
| Holdtime counting down very quickly | Monitor show cdp neighbors over several
seconds and watch the holdtime counter; compare with
show cdp traffic for errors |
Unstable physical link causing intermittent drops; advertisement interval or holdtime misconfigured; high CPU on the neighbour preventing CDP frame processing |
| Wrong device appearing on a port | Compare Device ID and Platform in CDP output against documentation; note the Local Interface and Port ID to trace the cable | Incorrect cable routing; wrong port used when patching; asset tag or documentation out of date |
| Duplicate Device ID in CDP table | show cdp neighbors detail — check if
two entries have different IP addresses but same hostname;
compare serial numbers if available |
Two devices configured with the same hostname; a loop in the physical topology sending CDP from the same device on two paths |
CDP-Based Topology Discovery Workflow
Start on any Cisco device in the network.
Step 1: run show cdp neighbors
→ Record: Device ID, Local Interface, Platform, Port ID for each neighbour
Step 2: run show cdp neighbors detail
→ Record: Management IP, IOS version for each neighbour
Step 3: SSH/Telnet to each neighbour's management IP
→ Repeat steps 1–3 on each newly discovered device
Step 4: Build a topology diagram
→ Each "Local Interface ↔ Port ID" pair = one physical cable
This recursive CDP walk will map the entire Cisco topology starting from
a single access point — even without a pre-existing network diagram.
Note: CDP only shows DIRECTLY connected neighbours (one hop).
Devices two hops away do not appear — you must CDP-walk from each
intermediate device to continue the discovery.
10. Using CDP for Network Documentation
CDP output is the authoritative source for physical connectivity in a Cisco network. The combination of Device ID, Local Interface, Port ID, and Platform from every device produces an accurate, cable-level topology map that reflects the current state of the network — not a potentially outdated CMDB or diagram.
Example: Mapping a 3-switch network using CDP alone.
Running "show cdp neighbors" on each switch:
On SW1:
Device ID Local Intrfce Holdtme Cap Platform Port ID
SW2 Gi 0/1 150 S I WS-C3750 Gi 0/1
SW3 Gi 0/2 140 S I WS-C2960 Gi 0/1
On SW2:
Device ID Local Intrfce Holdtme Cap Platform Port ID
SW1 Gi 0/1 160 S I WS-C3750 Gi 0/1
R1 Gi 0/24 155 R ISR4451 Gi 0/0
Derived topology:
SW1 Gi0/1 ────────── SW2 Gi0/1 (SW1–SW2 uplink)
SW1 Gi0/2 ────────── SW3 Gi0/1 (SW1–SW3 access)
SW2 Gi0/24 ───────── R1 Gi0/0 (core uplink to router)
For large networks, Python scripts using Netmiko or NAPALM can
automate the CDP walk — connecting to each device, running
show cdp neighbors detail, and building a full
topology graph automatically.
11. Exam Tips & Key Points
- CDP is Cisco-proprietary and operates at Layer 2 — it does not require IP addresses and works even on unconfigured devices.
- CDP is enabled by default on all Cisco IOS devices. It sends advertisements every 60 seconds; the default holdtime is 180 seconds.
- Know all six fields in
show cdp neighborsoutput: Device ID, Local Interface, Holdtime, Capability codes, Platform, Port ID. Know the most common Capability codes: R=Router, S=Switch, I=IGMP, P=Phone, H=Host. show cdp neighbors detailadds: IP address, IOS version, serial number, duplex, native VLAN, VTP domain, and management address.- Disable CDP globally with
no cdp run; disable per interface withno cdp enable(in interface config mode). Know the difference — a very common exam question. - CDPv2 (default) adds native VLAN, duplex, PoE, and VTP domain information compared to CDPv1.
- CDP vs LLDP: CDP is Cisco-only; LLDP is
IEEE 802.1AB multi-vendor standard. Both operate
at Layer 2. LLDP is disabled by default — enable with
lldp run. - CDP is a security risk — it exposes hardware model, IOS version, management IP, and topology to any device with physical port access. Always disable on user-facing, internet-facing, and DMZ ports.
- CDP only shows directly connected neighbours (one hop). Devices two or more hops away do not appear.
12. Summary Reference Table
| Topic | CDP Detail |
|---|---|
| Protocol type | Cisco proprietary, Layer 2 |
| Default state | Enabled globally and per-interface on all Cisco IOS devices |
| Advertisement interval | 60 seconds (configurable with cdp timer) |
| Holdtime | 180 seconds (configurable with cdp holdtime) |
| Multicast MAC | 0100.0CCC.CCCC |
| Summary command | show cdp neighbors |
| Detail command | show cdp neighbors detail |
| Disable globally | no cdp run (global config) |
| Disable per interface | no cdp enable (interface config) |
| Discovery scope | Directly connected neighbours only (one hop) |
| Multi-vendor equivalent | LLDP (IEEE 802.1AB) — lldp run to enable |
| Security risk | Exposes hostname, model, IOS version, management IP, native VLAN — disable on untrusted ports |