NetBox: Retiring Excel and Building a Network Infrastructure Source of Truth

Network tutorial - IT technology blog
Network tutorial - IT technology blog

The Nightmare Named IP_Management_v2_Final_Update.xlsx

Every network engineer has probably experienced this: 2:00 AM, your phone is vibrating uncontrollably. Your boss reports that the core system is unstable, with packets dropping constantly during peak hours. After three hours of fumbling through messy logs, you realize: a former colleague silently assigned a duplicate IP from a backup server to the standby Gateway.

When I opened the Excel file to double-check, I was horrified to find it hadn’t been updated in six months. That was a painful lesson that taught me: managing infrastructure manually via Excel is suicide. To operate professionally, you need a “Source of Truth” — and NetBox is the current industry standard.

What is NetBox? Why isn’t it just an IP Scanning tool?

Many people often mistake NetBox for tools like Angry IP Scanner. In reality, NetBox is a combination of IPAM (IP Address Management) and DCIM (Data Center Infrastructure Management).

The difference lies in the mindset. NetBox doesn’t scan the network to see which devices are online. Instead, it’s where you define how your network should look. If NetBox says IP 10.0.0.1 belongs to the Firewall, then that must be the reality. Every configuration change must be updated in NetBox before being implemented on the device. This approach allows you to control the infrastructure rather than chasing after it.

NetBox helps you manage centrally:

  • IPAM: Manage Prefixes, individual IP addresses, VRFs, and VLANs.
  • DCIM: Manage Racks, devices (Servers, Cisco/Juniper Switches), and physical locations.
  • Connectivity: Detailed tracking of every network cable, console port, and power map.
  • Virtualization: Manage Clusters and Virtual Machines (VMs).

Preparing the Deployment Environment

For the most stable production environment, I recommend installing NetBox via Docker Compose. This method isolates PostgreSQL, Redis, and the NetBox application. Backing up or upgrading later will be incredibly easy, taking only 5-10 minutes instead of hours fixing Python library conflicts.

Recommended configuration for a system with approximately 500-1000 devices:

  • OS: Ubuntu 22.04 LTS
  • CPU: 2 Cores
  • RAM: 4GB (NetBox runs Django and Redis, so it’s quite memory-intensive)
  • Disk: 20GB SSD

Step 1: Install Docker and Docker Compose

First, update the system and install supporting packages:

sudo apt update
sudo apt install -y curl git apt-transport-https ca-certificates gnupg lsb-release

# Install Docker Engine
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io

# Install Docker Compose v2
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Step 2: Download NetBox Docker Source Code

We will use the official build from the NetBox community to ensure we stay up to date:

git clone -b release https://github.com/netbox-community/netbox-docker.git
cd netbox-docker

Step 3: Configure System Parameters

In the project directory, create an override file to customize the access port if needed. Most importantly, generate a Secret Key to secure sessions.

# Configure port 8000 for web access
tee docker-compose.override.yml <<EOF
services:
  netbox:
    ports:
      - 8000:8080
EOF

# Generate a random secret key
echo "SECRET_KEY=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 50)" >> .env

Step 4: Launch the Services

Now, Docker will automatically download the necessary images. The speed of this process depends on your internet connection.

sudo docker-compose pull
sudo docker-compose up -d

Once the command finishes, wait about 1 minute for the database to initialize. You can monitor progress with the command: sudo docker-compose logs -f netbox.

Step 5: Create an Admin Account

To start using it, you need to create a Superuser account:

sudo docker-compose exec netbox /opt/netbox/netbox/manage.py createsuperuser

Using NetBox: From the Ground Up

Access http://<Server-IP>:8000 and log in. For NetBox to be effective, you need to input data according to the correct logical hierarchy instead of jumping straight to filling in IPs.

1. Setting up Sites (Locations)

Every device needs a “home.” Go to Organization > Sites to create a new one. For example: “DC Quang Trung” or “District 1 Office.”

2. Declaring Device Types

NetBox needs to know the technical specifications of your hardware. For example, how many network ports does a Cisco C9300-24T switch have? Defining templates allows you to add multiple devices of the same model later in just a few seconds.

3. Professional IPAM Management

Don’t enter IPs individually. Start with Prefixes. For example, you have the range 172.16.10.0/24 dedicated to the Camera VLAN.

  • Go to IPAM > Prefixes > Add.
  • Declare the IP range and assign it to the corresponding Site.

When you click on this Prefix, NetBox will clearly list which IPs are available (Containers). You just need to click the “+” sign to assign an IP to a Server or Switch. It’s highly intuitive and hard to mess up.

Real-world Experience: Don’t Do It Manually!

My biggest mistake when I first used NetBox was trying to manually type in information for 200 servers. Don’t repeat that mistake. NetBox has a very powerful REST API. Use a simple Python script to push data from your old Excel files into the system.

One fantastic feature is the Changelog. Every action, such as unplugging a cable or changing an IP, is recorded: who did it, when, and what changed. This is a lifesaver when you need to trace the root cause of an incident after an all-nighter.

If you are managing over 50 devices or 3-4 VLANs, install NetBox now. Don’t wait until an IP conflict occurs to start looking for a battered old Excel file.

Conclusion

NetBox is not just software; it is a modern management philosophy. The initial setup might take some effort, but the value it brings is a tidy infrastructure that is ready for Automation. I hope you all escape the nightmare of Excel soon!

Share: