Guide

How network topology discovery works: ARP, LLDP, CDP and SNMP bridge tables

Which device is plugged into which switch port? Mapping tools answer that by combining a few standard data sources. Knowing how helps you set up discovery and understand why a map sometimes looks wrong.

The question topology discovery answers

An inventory lists what is on the network. A topology map answers where: this printer is on port 7 of the second-floor switch, in VLAN 10. You need that to trace a fault to a cable, find an unknown device, or see what a switch failure would take down.

No single protocol gives the whole picture. Tools join three layers: IP-to-MAC from ARP and neighbour tables, switch-to-switch links from LLDP and CDP, and MAC-to-port from switch forwarding tables read over SNMP.

Layer 1: who is out there (ARP, neighbours, sweeps)

On IPv4, hosts resolve each other's MAC addresses with ARP and cache the result; IPv6 uses the neighbour discovery cache. Reading these tables, on a local computer or from the router over SNMP (ipNetToMediaTable or the newer ipNetToPhysicalTable), gives IP-to-MAC pairs.

Caches only hold recent talkers, so tools also sweep each subnet first. Passive listening adds DHCP host names and gateways (router advertisements, VRRP, HSRP). The first three bytes of a MAC (the OUI) identify the adapter's maker, often enough to tell a printer from a phone.

Sweep only networks you own, keep to private ranges of sensible size, and go gently on fragile embedded devices.

Layer 2: how switches connect (LLDP and CDP)

Switches, routers, access points and IP phones announce themselves to direct neighbours on each port, using LLDP (IEEE 802.1AB) or, on Cisco, CDP. Each announcement carries the sender's name, port, management address and capabilities.

Each device's neighbour table is readable over SNMP via the LLDP-MIB (lldpRemTable, local ports in lldpLocPortTable). Reading every switch gives the skeleton: switch A port 48 connects to switch B port 1. A computer can also listen to learn its own switch and port.

But computers rarely send LLDP, and cheap switches may not support it. For everything else you need forwarding tables.

Layer 3: which MAC is on which port (bridge tables)

A switch records which port each source MAC arrived on in its forwarding database (FDB), or MAC address table. Two standard MIBs expose it over SNMP:

  • BRIDGE-MIB (RFC 4188): dot1dTpFdbTable, with each MAC, its bridge port and status. The classic view, which ignores VLANs.
  • Q-BRIDGE-MIB (RFC 4363): dot1qTpFdbTable, indexed by VLAN (strictly, filtering database ID) and MAC. VLAN-aware switches usually fill this one and may leave the BRIDGE-MIB table empty. VLAN names are in dot1qVlanStaticTable.

Some vendors expose the classic table only per VLAN (VLAN-specific community or SNMPv3 context). Check that first if a table comes back empty.

From bridge port to interface name

FDB entries use bridge port numbers, not interface numbers. dot1dBasePortTable maps each bridge port to an ifIndex through dot1dBasePortIfIndex, and the IF-MIB gives the name and description (ifName, ifDescr, ifAlias), speed and status. Only then can a tool say "GigabitEthernet1/0/7" instead of "bridge port 7".

LLDP local ports need the same mapping: match lldpLocPortTable entries to an ifIndex by number or, if numbering differs, by port name.

Putting it together: uplinks and edge ports

Join the layers by MAC address. ARP says 10.0.10.25 is 00:1b:…; the core switch has that MAC on port 48; the access switch has it on port 7. Which is right? This is the central problem: switches also learn MACs on uplinks, for every host behind the next switch.

Tools resolve it with heuristics, roughly in this order:

  1. A port with a switch or router as LLDP or CDP neighbour is an uplink.
  2. A port where another known switch's own MAC appears is an uplink towards that switch.
  3. A port with many MACs is probably an uplink, an access point or an unmanaged switch.
  4. A host goes on the port with the fewest MACs among those it was seen on: the most "edge" location.

A phone with a PC behind it puts two MACs, often in two VLANs, on one port. Wi-Fi clients appear behind the access point's port.

SNMP security: v2c versus v3

SNMPv2c sends its community string in clear text, and a read-write community allows configuration changes. SNMPv3 adds authentication (HMAC with SHA or SHA-2), privacy (AES encryption) and replay protection.

  • Use SNMPv3 with authPriv wherever supported.
  • Grant read-only access; discovery never needs write.
  • Allow SNMP only from the management VLAN and the querying machine.
  • Store credentials encrypted; never paste them into tickets or chat.
  • Change default communities like "public" and "private".

Practical pitfalls

  • Aging timers. Switches forget silent MACs after a few minutes (often 300 seconds). Sweep first, then walk.
  • Stale entries on uplinks. A MAC can linger on an uplink after the device moved. Prefer the freshest, most edge location.
  • Overlapping subnets. Two sites can both use 192.168.1.0/24. Keep data per site so they don't merge.
  • Virtual MACs. Hypervisors, VRRP/HSRP and link aggregation create MACs seen in several places.
  • Large tables. Walking big FDBs with GETNEXT is slow; GETBULK helps, and tools should cap how much they read.

How DeskCentral approaches it

In DeskCentral network discovery, a computer you choose on each site is the probe. It reads neighbour tables, sweeps private subnets, can listen passively for DHCP, gateway and LLDP/CDP traffic (on Windows when Npcap is installed), and walks switches over SNMP v2c or v3 (BRIDGE-MIB, Q-BRIDGE-MIB, IF-MIB, LLDP-MIB and ARP tables) with credentials stored encrypted on the console. Networks are kept per probe, so overlapping subnets stay apart, and scheduled scans keep history with diffs.

Frequently asked questions

Do I need SNMP for network discovery?

No. ARP tables, ping sweeps and passive listening find hosts and their MAC addresses without SNMP. SNMP on switches is what shows which switch port each host is on.

Should I use SNMPv2c or SNMPv3?

Use SNMPv3 with authentication and encryption wherever devices support it. SNMPv2c sends the community string in clear text; if you must use it, make it read-only, long and random, and restrict who may query.

Why does one switch port show dozens of MAC addresses?

It is almost certainly an uplink to another switch or access point, or has a hypervisor or unmanaged switch behind it. Topology tools treat it as an uplink and place the hosts on the downstream port instead.

Related reading

See DeskCentral on your own fleet

Tell us how many computers, sites and clients you look after. We will walk you through the platform and put together a quote, self-serve or fully managed.