Your network has 50 switches. Your boss asks: “Which switches connect to which?” If you manually trace cables, you’ll spend 3 days documenting physical connections.

There’s a better way. LLDP (Link Layer Discovery Protocol) and CDP (Cisco Discovery Protocol) automatically advertise device identity to neighbors. Your monitoring tool reads these advertisements, builds a map, and shows you the entire topology automatically. This guide explains both protocols and how to use them.

What Is LLDP?

LLDP (Link Layer Discovery Protocol) is a vendor-neutral, open-source protocol defined in IEEE 802.1AB-2005. Every managed switch (Cisco, Arista, HP, MikroTik, Juniper) supports it. It’s the modern standard for network device discovery.

How it works:

  1. Your switch sends multicast LLDP frames every 30 seconds
  2. Neighboring switches receive the frame on each port
  3. Frame contains: device name, IP address, port description, capabilities
  4. Switch stores this information in its LLDP neighbor table

Example frame (decoded):

LLDP Frame from Switch A:
├─ Chassis ID (device identifier): "switch-a.isp.com"
├─ Port ID (which port sent frame): "Ethernet1/1"
├─ Management IP: "192.168.1.10"
├─ System Name: "access-switch-1"
├─ Port Description: "To HUB-01 eth10"
├─ System Capabilities: "Bridge, Router"
├─ TTL: 120 seconds

When Switch B receives this on port Ethernet2/5, it records: “Port Eth2/5 connects to Switch A, Ethernet1/1”

What Is CDP?

CDP (Cisco Discovery Protocol) is Cisco’s proprietary equivalent. Older, Cisco-only, but still widely deployed.

CDP vs LLDP comparison:

AspectLLDPCDP
StandardIEEE 802.1AB (open)Cisco proprietary
Works withAll vendorsCisco only
Multicast address01:80:c2:00:00:0e01:00:0c:cc:cc:cc
Frame interval30 seconds60 seconds
InformationBasic (name, IP, port)Detailed (VLAN, speed, duplex)
Modern networksPreferredLegacy
Future-proofYesNo

Recommendation: Enable both (they coexist), but prefer LLDP if you have choice.

Enabling LLDP on MikroTik

RouterOS bridges support LLDP. It’s simple:

/interface ethernet switch set [find] lldp=yes
/lldp print
# Output: enabled=no (this disables *sending* LLDP; receiving still works)

/lldp set enabled=yes
# Now send LLDP frames

Verify neighbors:

/lldp neighbor print
# Output:
# interface=ether1 chassis-id=00:11:22:33:44:55 device-name=switch-hub-01 port-description="To CPE-5"
# interface=ether2 chassis-id=00:11:22:33:44:66 device-name=switch-hub-02 port-description="To CPE-10"

Enabling LLDP on Cisco

(Cisco Switch)# lldp run
(config)# interface Ethernet1/1
(config-if)# lldp transmit
(config-if)# lldp receive
(config-if)# exit

# Verify:
(Cisco)# show lldp neighbors
# output:
# Device ID    Local Interface    Holdtime    Capability    Port ID
# switch-a     Eth1/1             120         B             Eth2/5
# switch-b     Eth1/2             120         B             Eth2/6

Enabling LLDP on HP/Arista

(HP Switch)# lldp enable
(config)# interface Ethernet1/1
(config-if)# lldp advertise-management-tlv system-description
(config-if)# exit

(Arista)# lldp run
(config)# interface Ethernet1
(config-if)# lldp transmit
(config-if)# lldp receive

SNMP OIDs for LLDP Polling

Your monitoring tool (YAD, LibreNMS, Zabbix) polls SNMP to read LLDP neighbors. These are the standard OIDs:

LLDP Neighbor Table

1.0.8802.1.1.2.1.3 = LLDP Remote Systems Data

Key OIDs:
├─ 1.0.8802.1.1.2.1.3.2 = Remote chassis ID
├─ 1.0.8802.1.1.2.1.3.3 = Remote system name
├─ 1.0.8802.1.1.2.1.3.4 = Remote system description
├─ 1.0.8802.1.1.2.1.3.7 = Remote port description
└─ 1.0.8802.1.1.2.1.3.8 = Remote management address

Query Example

# Poll all LLDP neighbors from a switch:
snmpwalk -v 2c -c public SWITCH_IP 1.0.8802.1.1.2.1.3.2

# Output (decoded):
# 1.0.8802.1.1.2.1.3.2.1.3.1.1 = Hex-STRING: 00 11 22 33 44 55
# 1.0.8802.1.1.2.1.3.2.1.3.1.2 = Hex-STRING: 00 11 22 33 44 66
# (means: 2 devices connected)

# Get system names:
snmpwalk -v 2c -c public SWITCH_IP 1.0.8802.1.1.2.1.3.3

# Output:
# 1.0.8802.1.1.2.1.3.3.1.4.1.1 = STRING: "regional-hub-1"
# 1.0.8802.1.1.2.1.3.3.1.4.1.2 = STRING: "regional-hub-2"

CDP OIDs (Cisco Only)

1.3.6.1.4.1.9.9.46.1.2 = CDP Neighbor Table

Key OIDs:
├─ 1.3.6.1.4.1.9.9.46.1.2.1.1.3 = Neighbor device ID
├─ 1.3.6.1.4.1.9.9.46.1.2.1.1.4 = Neighbor IP address
├─ 1.3.6.1.4.1.9.9.46.1.2.1.1.5 = Neighbor port
└─ 1.3.6.1.4.1.9.9.46.1.2.1.1.6 = Neighbor platform

Real ISP Network Topology Discovery

You run an ISP with this physical layout:

[Internet] → [Border Router (RB4011)]
              ├─ eth10 → [Regional Hub 1 (RB4011)]
              │           ├─ eth1 → [Access Switch A]
              │           │         ├─ port1 → [OLT]
              │           │         └─ port5 → [CPE-1]
              │           └─ eth2 → [Access Switch B]
              │                     └─ port1 → [CPE-2]
              └─ eth11 → [Regional Hub 2 (RB4011)]

Step 1: Enable LLDP Everywhere

Border Router:

/lldp set enabled=yes
/interface ethernet switch set [find] lldp=yes

Regional Hub 1 & 2:

/lldp set enabled=yes
/interface ethernet switch set [find] lldp=yes

Access Switches (Cisco/HP):

switch# lldp run
switch# interface range Ethernet 1-48
switch# lldp transmit
switch# lldp receive

Step 2: Verify Neighbors Manually

From Border Router:

/lldp neighbor print
# output:
# interface=ether10 device-name=regional-hub-1 port-description="eth10"
# interface=ether11 device-name=regional-hub-2 port-description="eth11"

From Regional Hub 1:

/lldp neighbor print
# output:
# interface=ether10 device-name=border-router port-description="eth10"
# interface=eth1 device-name=access-switch-a ...
# interface=eth2 device-name=access-switch-b ...

From Access Switch A (Cisco):

# show lldp neighbors
# output:
# Device ID          Local    Holdtime    Capability    Port ID
# regional-hub-1     eth1     120         BR            eth1
# olt-device         port1    120         B             management-ip

Step 3: Import into Monitoring Tool

LibreNMS:

  1. Add all devices (Border Router, 2 Hubs, 2 Switches, OLT, CPEs)
  2. LibreNMS automatically polls LLDP OIDs
  3. Navigate to: Device → Neighbors
  4. Topology map auto-generates

YAD:

  1. Add devices to YAD UI
  2. Click “Import LLDP Topology”
  3. YAD discovers neighbors via SNMP
  4. You get visual map

Step 4: Visualize

Your monitoring tool generates:

               [Border Router]
              /                \
        [Hub 1]            [Hub 2]
        /     \
  [Switch A] [Switch B]
  /   |  \
[OLT][CPE1] ...

Troubleshooting LLDP Discovery

Issue: “No neighbors found”

Check 1: Is LLDP enabled?

/lldp print
# output: enabled=yes (required)

/interface ethernet switch print
# output: lldp=yes on all interfaces

Check 2: Do physical cables connect the devices?

Test with ping:

/ping 192.168.1.10
# If timeout, cable is broken or firewall blocks ICMP

Check 3: Are you polling correct OIDs?

Test manually:

snmpwalk -v 2c -c public DEVICE 1.0.8802.1.1.2
# If empty, SNMP disabled or LLDP not running

Issue: “LLDP sees some neighbors, but not all”

Likely cause: LLDP only sees directly connected neighbors (L2). If there’s a router between devices, LLDP won’t see across it.

Example:

[Device A] ← LLDP works → [Switch]
                            ↓ (IP routing, L3)
                         [Device B]
# LLDP from A sees Switch, but NOT B (IP hop between them)

Solution: Use hierarchical topology (poll each device’s direct neighbors, not global map).

Issue: “CDP works, LLDP doesn’t”

Likely cause: LLDP is disabled, or vendor doesn’t support it.

Check:

# Cisco example:
show lldp neighbors  # Works
show lldp           # Shows if globally enabled

Enable CDP as fallback:

(Cisco)# cdp run
(config)# interface Ethernet1/1
(config-if)# cdp enable

Performance Impact of LLDP

LLDP frames:

CPU impact:

No measurable impact on production traffic.

LLDP in Large Networks (100+ Switches)

For large ISPs:

  1. Collect LLDP from ALL devices (automated via monitoring tool)
  2. Build full layer-2 map (graph processing)
  3. Detect loops (spanning tree protocol violations)
  4. Monitor STP (bridge priority, root cost)

LibreNMS does all of this automatically. Deploy it, enable SNMP + LLDP on all switches, and within 1 hour you have a complete network map.

Automated Topology Visualization

Once you have LLDP data, you can auto-generate network diagrams:

# Python + Graphviz
from pysnmp.hlapi import *

def build_topology():
    devices = get_all_devices()  # From monitoring DB
    
    graph = digraph()
    for device in devices:
        lldp_neighbors = snmp_walk(device, "1.0.8802.1.1.2.1.3")
        for neighbor in lldp_neighbors:
            graph.edge(device, neighbor)
    
    graph.render("network_topology.png")

Result: Auto-generated network diagram updated every hour.

Conclusion

LLDP is the foundation of modern network discovery:

For ISPs with 50+ switches, LLDP discovery saves weeks of manual topology mapping and provides ongoing SLA benefits (detect spanning tree loops, identify single points of failure).

Discover network topology with YADyetanotherdude.io
Automatic LLDP/CDP parsing, drag-drop editor, topology-aware alerting.