Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

Layer 2 Discovery

Direct answer

Layer 2 discovery protocols let directly connected devices announce themselves: CDP (Cisco) and LLDP (IEEE 802.1AB) send the device name, port, platform, addresses and capabilities to the neighbour on each link.

When to use this

Use it to confirm what is plugged into a port, map the physical topology, and find cabling mistakes.

First 30 seconds

1. show cdp neighbors (and show lldp neighbors) — is the expected neighbour on the expected port?

2. Wrong neighbour or port → cabling or documentation is wrong.

3. No neighbour → protocol off on either side, or a non-Cisco device without LLDP.

4. show cdp neighbors <if> detail — management address to reach the neighbour.

5. Watch logs for native VLAN and duplex mismatch messages from CDP.

Operational verification

protocol enabled on both ends → advertisements sent on the link → neighbour entry created → device name and remote port match the design

Evidence · next step

Move to the service boundary: interface errors → EtherChannel if present → VLAN/trunk/STP → L3/routing/policy as applicable.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Treating a learned neighbor as evidence that production traffic can pass.
  • Treating a missing neighbor as evidence that the cable is broken before checking protocol enablement.
  • Assuming CDP and LLDP use the same standards, defaults or TLVs.
  • Leaving discovery enabled on interfaces where the security/design policy says it should be disabled.
  • Trusting an advertised management address as evidence of current IP reachability.
  • Ignoring the remote-port identifier when tracing cabling.
Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE
Scope / prerequisiteUse it to confirm what is plugged into a port, map the physical topology, and find cabling mistakes.
What next?2 suggested next steps
Child topics (this level)2
Evidence2
On this pageJump to a specific section
Evidence references

Evidence · 2 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

command output · 2
Command lookup Jump straight to Cisco syntax
Drill down

Subtopics

Go one level deeper into this subject.

Key points

They only see direct neighbours. CDP is on by default on Cisco devices; LLDP must often be enabled with lldp run. Turn them off on ports towards untrusted networks, since they disclose platform and software details.

Key checks
  • show cdp neighbors — neighbour device, local port, remote port, platform.
  • show cdp neighbors <if> detail — addresses, software version, native VLAN, duplex.
  • show lldp neighbors — the same for LLDP neighbours.
  • show lldp neighbors <if> detail — system name, port description, management address, capabilities.
  • show cdp interface / show lldp interface — where the protocols run.
ReferenceWhy it matters1 section · depth on demand

Why it matters

Use discovery information to identify what is physically connected to a switch/router interface, validate cabling and peer identity, map local-to-remote ports, and accelerate first-hop troubleshooting before changing VLAN, STP or routing configuration.

ReferenceHow it works1 section · depth on demand

How discovery works

CDP and LLDP periodically send link-local advertisements on an interface. The receiving neighbor records the advertised identity and capabilities until the hold time expires. These advertisements do not discover devices beyond the directly connected link and do not participate in VLAN forwarding, spanning-tree calculation, EtherChannel negotiation or IP routing.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

Layer 2 discovery with CDP and LLDP

Discovery protocols tell a device who is on the other end of each link. Cisco's IOS XE system management guide describes CDP as a Layer 2, media- and network-independent protocol. It sends periodic advertisements to multicast address 01:00:0C:CC:CC:CC, by default every 60 seconds, and Cisco devices never forward them. Receivers keep the information for the hold time and discard it after three missed advertisements. LLDP (IEEE 802.1AB) does the same job between devices from different vendors.

CDP and LLDP compared

CDPLLDP
StandardCisco proprietaryIEEE 802.1AB
Default interval60 s30 s (Cisco default)
Default hold time180 s120 s (Cisco default)
Endpoint extensionsVoice VLAN, powerLLDP-MED: network policy, power, location, inventory
Typical useCisco-to-Cisco links, Cisco phonesMulti-vendor links, third-party phones and APs

What discovery answers

QuestionCommand
What's connected to this port?show cdp neighbors <int>, show lldp neighbors <int>
Which IP manages that neighbour?show cdp neighbors detail, show lldp neighbors detail
Is the cabling as documented?Compare local and remote ports with the cable plan
Do native VLAN and duplex match?CDP version 2 reports mismatches
SW1# show cdp neighbors
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
dist1.example.net Ten 1/1/1         142            R S I  C9500-24Y Twe 1/0/3
SEP0011AA22BB33  Gig 1/0/7         131             H P M  IP Phone  Port 1
SW1# show lldp neighbors
Device ID           Local Intf     Hold-time  Capability      Port ID
ap-2f-07            Gi1/0/12       110        B,R             0011.22aa.0712
Total entries displayed: 1
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on TenGigabitEthernet1/1/1 (1), with dist1 TwentyFiveGigE1/0/3 (99).

Discovery and exposure

Both protocols send device details in clear text: hostname, platform, software version and addresses. Run them on infrastructure and phone ports. Disable them where they face untrusted networks, such as Internet edges, provider handoffs and guest ports, with no cdp enable and no lldp transmit per interface.

Limits

A neighbour entry proves only that a discovery frame arrived recently. It doesn't prove IP reachability, VLAN consistency or that traffic flows.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Quick reference

Layer 2 discovery protocols let directly connected devices identify each other. They are invaluable for tracing cables and building topology maps, and IP phones rely on them for VLAN and power information. The same details are useful to an attacker, so the protocols should be enabled where they help and disabled where devices face untrusted networks.

Layer 2 discovery protocols:

ProtocolStandardNotes
CDPCisco proprietaryEnabled by default on Cisco devices
LLDPIEEE 802.1ABMulti-vendor; LLDP-MED adds voice VLAN, PoE, location
show cdp neighbors detail
lldp run
show lldp neighbors detail
interface Gi1/0/1
 no cdp enable          ! on untrusted/internet-facing ports

They reveal device type, software version, IP and VLANs — useful for operations, useful for attackers too. Disable on edges toward untrusted networks; keep on infrastructure links.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

Authoritative/upstream documentation reviewed for bounded claims in Switching → Layer 2 Discovery. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%
Embedded reference data

Quick lookup tables

CDP vs LLDP

Fast comparison of the two discovery protocols

PropertyCDPLLDP
StandardCisco proprietaryIEEE 802.1AB
Scopedirectly connected linkdirectly connected link
Typical useCisco-centric topology discoveryvendor-neutral topology discovery
Global enablecdp runlldp run
Summaryshow cdp neighborsshow lldp neighbors
Detailshow cdp neighbors detailshow lldp neighbors detail
Provesadvertisement received from direct peeradvertisement received from direct peer
Does not proveVLAN/IP/end-to-end forwardingVLAN/IP/end-to-end forwarding

Layer 2 discovery troubleshooting boundary

Fast order for a missing or unexpected neighbor

BoundaryCheckHealthy indicationIf unhealthy
Physical/interfaceinterface state/cablingintended link is operationalfix physical/interface state
Global protocolshow cdp / show lldpintended protocol globally activeenable or follow policy
Interface protocolshow cdp interface / show lldp interfaceprotocol active in intended directioncorrect interface discovery state
Neighborsummary/detailexpected device and remote port learnedcompare peer protocol/interface
ServiceVLAN/STP/EtherChannel/IP checksservice state matches designtroubleshoot the actual forwarding layer
Confirmation

Confirm action

Continue?