NetBox for Mere Mortals
Every network of more than a few machines grows the same artefact: a spreadsheet, a wiki page, or a text file that claims to say which address belongs to which box, what is plugged in where, and what that cable in the ceiling actually connects. The file is always out of date, because nothing checks it and nothing else depends on it. NetBox is the program networks grow into instead: a source of truth — one database, kept on a machine you control, that records your sites, your devices, their interfaces and cables, and the prefixes and IP addresses those devices use. It holds the records in a real database with real rules, shows them in web pages, and offers the same records to other programs through an API, so the spreadsheet's job — answering "what is where, and what address does it have" — gets one answer that other tools can also read.
One line of care belongs here, before any procedure: a NetBox database is a map of a network, and a map is sensitive in itself. It tells anyone who reads it exactly what exists and where to aim. Only ever document networks you own or are authorised to document, guard the database and its backups the way you would guard a password, and treat API tokens as the credentials they are. This guide's lab documents an invented network, on loopback, with made-up names — which is the right shape for learning it.
The lab behind this guide ran the real thing: NetBox 4.7.4, the official release, installed from its source tarball onto a small Linux machine, backed by a real PostgreSQL 16 database and a real Redis 7 server, both started for the lab. Against that install the lab ran all 337 database migrations, signed in through the web pages, and then did the whole point of the tool through its API: it created a site, a manufacturer, a device type, a device role, two devices, interfaces, a cable between them, a prefix, and an IP address — and read every record back. It also watched NetBox refuse things: a duplicate site, and a bad API token. And it ran NetBox's background worker once, in burst mode, and watched it complete a real housekeeping job.
What the lab could not do, it did not
fake. Production dress — a real web
server in front, the worker running as
a permanent service, logins delegated
to another system, plugins, and asking
devices questions over the network —
is taught from the documentation and
labelled as such wherever it appears.
criteria.md keeps the full ledger of
what was run and what was only read.
What this guide covers
- What NetBox is — the mental model: a source of truth for a network, what "intent" means, and why a checked database beats a hopeful spreadsheet
- The moving parts — the web application, PostgreSQL, Redis, the background worker, and which part holds what
- Installing NetBox — the release tarball, the Python environment, the configuration file, and the migrations that build the database
- Your first sign-in — the administrator account, the sign-in page answering, and what an empty NetBox looks like
- Sites and places — the top of the map: sites, locations and racks, and the slug that names each one for the API
- Devices — the chain every device hangs from: manufacturer, device type, role, and the device itself
- Prefixes and addresses — the IPAM half: prefixes that contain addresses, addresses that belong to interfaces, and the primary address
- Interfaces and cables — the connections: an interface on a device, and a cable joining two of them
- The API and tokens — tokens as credentials, the shape of a request, and reading back everything the earlier chapters made
- Recipes — record a new device end to end, find a free address, rename without breaking links, and check the map against itself
- The neighbours — phpIPAM, Nautobot, spreadsheets and inventory tools: what each does that NetBox doesn't, and vice versa
- Limits — a record is not a discovery, a map nobody updates is fiction, the stack is heavy for a small network, and the other honest edges
- Troubleshooting — the token that reads as the wrong version, the duplicate that is refused, the worker queue that grows, and the traps this guide's lab fell into
- Glossary — the terms, collected in one place
What it doesn't cover
Running NetBox in production for a large organisation — clustering, high availability and delegated logins are pointed at, not taught. Writing plugins or custom scripts for NetBox is its own project with its own guide's worth of material. Asking real devices questions (the NAPALM integration) is described, not run: the lab's network is invented, and its two switches exist only as records — which is, honestly, the normal state of a device in NetBox.
How to use this guide
Read chapter 1 for the model, and
chapter 2 before installing anything —
NetBox is four programs wearing one
name, and knowing which part holds what
turns later confusion into a named
problem. Chapters 3 and 4 get you a
running install and an empty home page;
chapters 5 to 8 build one small network
record by record, in the order the
records depend on each other. Chapter 9
is the one to read slowly: the API is
where NetBox stops being a notebook and
starts being infrastructure. The lab's
transcripts live in netbox-lab/transcripts/;
its API script is netbox-lab/api-proof.sh.
Part of the series
This guide is one of the For Mere Mortals guides: plain-language guides to the tools programmers and makers use.
Related guides:
- PostgreSQL for Mere Mortals
- Redis for Mere Mortals
- Networking for Mere Mortals
- Ansible for Mere Mortals
License
The writing in this guide is licensed under CC BY 4.0. Code examples and lab scripts are licensed under the MIT License.