Free tech learning for everyone, from basics to pro

Network AutomationProgramming and Application SecurityIntermediate

Source of truth: IPAM and DCIM tools such as NetBox and why they matter

In short: A source of truth is the one trusted place that records how the network should be. IPAM (IP address management) and DCIM (data centre infrastructure management) tools such as NetBox hold sites, devices, prefixes and cables. Automation reads intended state from it, so templates, inventories and audits all agree.

The problem: many versions of the truth

In many organisations, IP addresses live in a spreadsheet, rack layouts in a drawing, device lists in the monitoring system and the real answer only on the devices. They drift apart, and nobody knows which to trust. Automation makes this worse: if a script reads the wrong spreadsheet, it pushes the wrong configuration everywhere. A source of truth (SoT) solves this by being the single, agreed place that records the intended state of the network.

Source of truthNetBoxintended stateIPAMprefixes, addressesDCIMsites, racks,devicesCablingwhat connects whereAutomationtemplates, NornirMonitoringwhat to pollAuditcompare to reality
Figure 1. A source of truth holds intended state that automation, monitoring and auditing all read from.

IPAM, DCIM and NetBox

  • IPAM (IP address management) tracks aggregates, prefixes, VLANs, VRFs (virtual routing and forwarding instances) and individual addresses.
  • DCIM (data centre infrastructure management) tracks sites, racks, device types, devices, interfaces, power and cables.

NetBox is a widely used open-source tool that combines both, with a web interface and a full REST API. Nautobot, which began as a fork of NetBox, offers a similar model with its own app ecosystem. Commercial IPAM and DDI (DNS, DHCP and IPAM) products exist too. The tool matters less than the discipline of keeping one source authoritative.

DataExample use in automation
Devices, roles, platformsBuild Nornir or Ansible inventories
Prefixes and IP addressesAllocate the next free address; render interface config
VLANsGenerate trunk and access port configuration
Cables and interfacesWrite interface descriptions; check LLDP neighbours
Custom fields and tagsMark devices for a feature or a compliance policy

Querying NetBox from Python

The pynetbox library wraps the NetBox API. Create an API token for a service account with only the permissions it needs, and load it from an environment variable.

import os
import pynetbox

nb = pynetbox.api("https://netbox.example.com", token=os.environ["NETBOX_TOKEN"])

for dev in nb.dcim.devices.filter(site="london", role="access-switch"):
    ip = dev.primary_ip4.address if dev.primary_ip4 else "no IP"
    print(dev.name, dev.platform, ip)

prefix = nb.ipam.prefixes.get(prefix="192.168.10.0/24")
free = prefix.available_ips.list()
print("Next free address:", free[0] if free else "none")

The same data can feed a Jinja2 template, a Nornir inventory (through the nornir_netbox plugin) or an Ansible dynamic inventory.

Working with intent

Intent-driven workflowRecord intentin NetBoxRendertemplatesDeployautomationVerifycompare liveFix driftor updateintent
Figure 2. Changes start in the source of truth and flow out to the network, never the other way round.

The golden rule is that changes start in the SoT. If an engineer changes a device directly, the next automated run will either undo it or report it as drift. That is a feature: it forces changes through review.

  1. Import existing data carefully and clean it up; bad data in means bad config out.
  2. Decide which system owns which data, for example NetBox for addresses and the HR system for staff.
  3. Lock down write access and require change tickets for edits.
  4. Generate configuration from the SoT for one small area first.
  5. Run regular reports comparing live devices with intended state.

Tip: the SoT is now a high-value target. Anyone who can edit it can change the network through automation, so protect it with SSO (single sign-on), MFA (multi-factor authentication), role-based permissions, backups and audit logs.

Practice

What is the difference between a source of truth and a monitoring system?
The source of truth records intended state (how the network should be). Monitoring observes actual state (how it is now). Comparing them reveals drift.
Name two things IPAM tracks and two things DCIM tracks.
IPAM: prefixes, IP addresses, VLANs, VRFs. DCIM: sites, racks, devices, interfaces, cables, power.
Why should API tokens for NetBox be scoped and stored outside scripts?
A token with write access can change intended state that automation then pushes to the network. Least-privilege tokens kept in environment variables or a vault limit that risk.

Key takeaways

  • A source of truth is the single trusted record of intended network state.
  • IPAM covers addressing; DCIM covers physical and logical infrastructure.
  • NetBox combines both with a REST API; pynetbox queries it from Python.
  • Changes start in the SoT and flow out; differences are drift.
  • Protect the SoT with MFA, permissions and audit logs.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.