How to get a network diagram from CDP and LLDP
To get a network diagram from CDP and LLDP, collect the neighbour table of every switch and router, then join the entries into links: local device and port on one side, remote device and port on the other. Each table only knows the directly connected neighbours, so the diagram is only as complete as the list of devices you read. NacTrack collects both tables at every round and draws the result as a layer 2 map you can arrange, save and export.
What you need
- Module required: neighbors.
- Permission required: view_topology.
- Every collected platform that runs CDP or LLDP; view_cdp or view_lldp also open the map.
In NacTrack
- 1
Open Inventory, then Multi-Layer Topology
The base graph merges the CDP and LLDP neighbour records of every collected device. In the L2 Discovery section of the sidebar, CDP and LLDP each have their own toggle. Phones and access points are hidden by default and can be loaded on request.
Screen: app.nactrack.com/neighbors/topology/multi
- 2
Show the neighbours outside the inventory
Turn on External Devices to draw the neighbours that answer CDP or LLDP but are not in the inventory. Their panel says "External (not in inventory)". Hide Orphan Devices removes nodes with no link in the current view.
Screen: app.nactrack.com/neighbors/topology/multi
- 3
Arrange, save and export
Positions are saved as you move nodes, and named views keep several layouts. Export the diagram as PNG, SVG, PDF or a .drawio file to edit it further in diagrams.net.
Screen: app.nactrack.com/neighbors/topology/multi
By hand, without NacTrack
On Cisco, "show cdp neighbors detail" lists each neighbour with its device ID, local and remote port, platform and address. Cisco's CDP guide notes that CDP is enabled by default, runs only on Cisco devices, and is never forwarded: each entry is a direct neighbour. For mixed vendors, LLDP is the standard (IEEE 802.1AB): "show lldp neighbors detail" on Cisco, "display lldp neighbor" on Huawei VRP, once LLDP is enabled on both ends.
Run the command on every device, write one line per link (device A, port, device B, port), remove the duplicates seen from both ends, and draw. That last step is the one a spreadsheet does badly and a diagram tool does by hand.
What this view does not tell you
- A device that runs neither CDP nor LLDP draws no link, and a link where one end has the protocol off only appears if the other end reports it. Servers and firewalls often announce nothing.
- The map shows what the last collection saw, not a live view. The routing, spanning tree and overlay layers (OSPF, BGP, IS-IS, VPLS, VXLAN and others) are separate layers, each behind its own module and permission.
- There is no Visio export; .drawio is the editable format.
Further reading
Automatic network topology mapping from CDP and LLDP
Topology built from the neighbours your devices report over LLDP and CDP, at layer 2 and layer 3, not from a diagram drawn three years ago.
How-to guideHow to find the network devices nobody declared
Find undeclared network devices: CDP and LLDP neighbours missing from the inventory, a crawl from seeds or subnets, and what announces nothing.
How-to guideHow to find which switch is root bridge for each VLAN
If the root bridge is not where you designed it, traffic takes a path you did not choose. Read the root for every switch and every VLAN.
