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.
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:
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”
CDP (Cisco Discovery Protocol) is Cisco’s proprietary equivalent. Older, Cisco-only, but still widely deployed.
CDP vs LLDP comparison:
| Aspect | LLDP | CDP |
|---|---|---|
| Standard | IEEE 802.1AB (open) | Cisco proprietary |
| Works with | All vendors | Cisco only |
| Multicast address | 01:80:c2:00:00:0e | 01:00:0c:cc:cc:cc |
| Frame interval | 30 seconds | 60 seconds |
| Information | Basic (name, IP, port) | Detailed (VLAN, speed, duplex) |
| Modern networks | Preferred | Legacy |
| Future-proof | Yes | No |
Recommendation: Enable both (they coexist), but prefer LLDP if you have choice.
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"
(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
(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
Your monitoring tool (YAD, LibreNMS, Zabbix) polls SNMP to read LLDP neighbors. These are the standard OIDs:
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
# 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"
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
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)]
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
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
LibreNMS:
YAD:
Your monitoring tool generates:
[Border Router]
/ \
[Hub 1] [Hub 2]
/ \
[Switch A] [Switch B]
/ | \
[OLT][CPE1] ...
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
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).
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
LLDP frames:
CPU impact:
No measurable impact on production traffic.
For large ISPs:
LibreNMS does all of this automatically. Deploy it, enable SNMP + LLDP on all switches, and within 1 hour you have a complete network map.
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.
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 YAD → yetanotherdude.io
Automatic LLDP/CDP parsing, drag-drop editor, topology-aware alerting.