Find the device at the other end of a cable
Run show cdp neighbors or show lldp neighborsto identify a connected device and the port at each end of its link. Use CDP between supported Cisco devices and LLDP for a mixed-vendor network. Check support and defaults for your platform; a device may support either protocol, both, or neither.
Both share information such as:
- the neighbour's name (the Device ID, usually its hostname),
- the neighbour's own interface the cable is plugged into (the Port ID),
- its capabilities (router, switch, phone, access point),
- system information and management addresses, when advertised.
Device key: R1 (router) · SW1, SW2 (switch) · AP-FLOOR1 (access point) · PC1 (computer) · ISP (network / service)
Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- R1: Cisco ISR
- SW1: C9200L
- SW2: C9200L
- AP-FLOOR1: third-party AP
- PC1: IP 192.168.10.10
- 1. SW1 and SW2 advertise to R1. Each switch advertises on its active CDP-enabled ports; R1 records both neighbours, with the port at each end.
- 2. R1 advertises back. Discovery runs in both directions, so each switch also lists R1.
- 3. The third-party AP speaks only LLDP. SW1 sees AP-FLOOR1 only if LLDP is enabled on SW1. CDP alone would miss it.
- 4. CDP toward the ISP is a leak. R1 would advertise its model and IOS version to a network you don't control. Turn CDP off on Gi0/0.
- 5. Only one hop. SW1 does not pass the AP's or anyone else's messages on. R1 never learns about AP-FLOOR1 or PC1.
Why discovery stops at one hop
CDP and LLDP run at Layer 2. Each message is an Ethernet frame sent to a reserved multicast MAC address (CDP uses 01:00:0C:CC:CC:CC, LLDP uses 01:80:C2:00:00:0E). Because no IP is involved, discovery works even before addresses are configured or when IP is misconfigured. That is exactly when you need it most.
A device that understands the protocol keeps the frame and does not forward it. That is deliberate: the table should describe the cable you are standing at, not a device three switches away. A Cisco switch therefore normally lists only the devices it is directly cabled to. A hub or a switch that floods CDP frames can make several neighbours appear on one port. Do not assume LLDP passes through the same way: its reserved destination is normally filtered by Ethernet bridges.
Advertisements, holdtime and expiry
Each message carries a holdtime: how long the receiver should keep the entry if it hears nothing more. The sender repeats its message on a timer well inside that holdtime, so a healthy neighbour never expires.
| Setting | CDP | LLDP |
|---|---|---|
| Standard | Cisco proprietary | IEEE 802.1AB (open) |
| Typical IOS / IOS XE global default* | Enabled | Disabled |
| Advertisement timer | 60 s | 30 s |
| Holdtime | 180 s | 120 s |
| Turn on/off globally | cdp run / no cdp run | lldp run / no lldp run |
| Per interface | cdp enable / no cdp enable | lldp transmit and lldp receive (separately) |
*Defaults and supported interfaces vary by platform and release. Verify with show cdp and show lldp.
Turning CDP and LLDP on and off
Based on Cisco IOS / IOS XE documentation, not run on a lab device.
CDP
cdp run
interface GigabitEthernet0/0
no cdp enablecdp run is the default, shown for completeness. Turn CDP off on the interface that faces the ISP. no cdp run would turn it off on every interface at once.
cdp timer 30
cdp holdtime 90Optional: change how often CDP is sent and how long neighbours keep the entry. Keep the holdtime longer than the timer (three times is the usual ratio).
LLDP
lldp run
interface GigabitEthernet1/0/20
lldp transmit
lldp receiveOn SW1: enable LLDP globally. Explicitly enable transmit and receive on the AP-facing port. Check show lldp interface to confirm its state.
interface range GigabitEthernet1/0/2 - 19
no lldp transmit
no cdp enableOn user-facing access ports where no network device or phone connects, stop advertising. You can keep receiving with lldp receive if you want to see what users plug in.
lldp timer 30
lldp holdtime 120
lldp reinit 2The defaults: advertise every 30 s, hold for 120 s, and wait 2 s before restarting LLDP on an interface after it is re-enabled.
A full example: R1
! Keep CDP for the internal links, drop it toward the ISP
cdp run
lldp run
interface GigabitEthernet0/0
description WAN to ISP
no cdp enable
no lldp transmit
no lldp receiveDiscovery on the LAN side, silence on the internet side.
Reading the neighbour tables
R1#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform Port ID SW1 Gig 0/1 152 S I C9200L-24 Gig 1/0/24 SW2 Gig 0/2 147 S I C9200L-24 Gig 1/0/24 Total cdp entries displayed : 2
R1#show cdp neighbors detail ------------------------- Device ID: SW1 Entry address(es): IP address: 192.168.10.2 Platform: cisco C9200L-24T-4G, Capabilities: Switch IGMP Interface: GigabitEthernet0/1, Port ID (outgoing port): GigabitEthernet1/0/24 Holdtime : 138 sec Version : Cisco IOS Software [Cupertino], Catalyst L3 Switch Software (CAT9K_LITE_IOSXE), Version 17.9.4, RELEASE SOFTWARE (fc5) advertisement version: 2 Native VLAN: 1 Duplex: full Management address(es): IP address: 192.168.10.2 ------------------------- ...
show cdp entry SW1 shows the same for one neighbour.R1#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled
show cdp interface lists which interfaces are running CDP; Gi0/0 should be missing from that list after no cdp enable.SW1#show lldp neighbors Capability codes: (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other Device ID Local Intf Hold-time Capability Port ID R1 Gi1/0/24 120 R Gi0/1 AP-FLOOR1 Gi1/0/20 120 W eth0 Total entries displayed: 2
eth0 or a MAC address.SW1#show lldp Global LLDP Information: Status: ACTIVE LLDP advertisements are sent every 30 seconds LLDP hold time advertised is 120 seconds LLDP interface reinitialisation delay is 2 seconds
% LLDP is not enabled instead. Use show lldp neighbors detail for addresses and versions, and show lldp interface for per-port settings.Missing, stale and surprising neighbours
- A neighbour you expect is missing. Check the link is up/up with
show ip interface brief; discovery needs a working Layer 2 link. Then check the protocol is running on both ends (show cdp interface,show lldp interface). Wait up to a full timer interval after a change. - A non-Cisco device doesn't appear. Most non-Cisco devices don't speak CDP. Enable LLDP with
lldp run. - An old neighbour is still listed after recabling. An entry can remain until its holdtime runs out if it was not removed on link-down. To remove cached entries immediately, use
clear cdp tableorclear lldp table. - IP phones lose their voice VLAN. Phones can learn the voice VLAN through CDP or LLDP-MED, depending on the device and configuration. Before disabling discovery, check which protocol the phone uses for VLAN and power negotiation.
- The table shows a device you didn't expect, several hops away. A device between you that doesn't process CDP may flood its multicast frames. A hub can also repeat them, making two Cisco devices appear directly connected. Trace the physical path before relying on that assumption.
Check the result
- Confirm the expected neighbour and both port IDs in the table.
- Use the detail view to inspect advertised management addresses. Test IP reachability separately before trying SSH.
- Confirm discovery is disabled on the untrusted interface and still running on the intended internal ports.
- Save the configuration with
copy running-config startup-config.
For link and IP checks, see Cisco show commands.
Test yourself on CDP and LLDP
On R1, show cdp neighbors shows 'SW2 Gig 0/2 147 S I C9200L-24 Gig 1/0/24'. Which port on SW2 is the cable plugged into?
SW1 connects to an AP that advertises LLDP but not CDP. The link is up, but LLDP is disabled on SW1. What should you enable?
R1 is connected to SW1, and SW1 to SW2. Both switches are Cisco with CDP on. Does show cdp neighbors on R1 list SW2?
You want to stop CDP only on R1's internet-facing Gi0/0 and keep it everywhere else. Which command do you use?
What are the default LLDP advertisement timer and holdtime?