Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Netbox with Tailscale Sidecar Configuration

This Docker Compose configuration sets up Netbox with Tailscale as a sidecar container to securely access your Network layout over a private Tailscale network. By using Tailscale in a sidecar configuration, you can enhance the security and privacy, ensuring that they are only accessible within your Tailscale network.


Netbox

Netbox exists to empower network engineers. Since its release in 2016, it has become the go-to solution for modeling and documenting network infrastructure for thousands of organizations worldwide. As a successor to legacy IPAM and DCIM applications, NetBox provides a cohesive, extensive, and accessible data model for all things networked.

--

Configuration Overview

In this setup, the tailscale-netbox service runs Tailscale, which manages secure networking for the Netbox application. The netbox application uses the Tailscale network stack via Docker's network_mode: service: configuration. This setup ensures that your Netbox application is only accessible through the Tailscale network (or local as well, if preferred).

Files to Check

Ensure the following files are correctly configured:

  • .env — contains environment variables and authentication keys.
  • ./config/serve.json — defines how Tailscale serves the n8n web interface securely on port 443.

Running the Stack

docker compose up -d

asciicast

Creating the Super User

For the 1st time login, the super user needs to be created. Run the following command:

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

Adding Netbox Plugins

Netbox has many plugins available to make your life easier. These need to be installed inside the container as follows:

#Connect to the container
docker compose exec -it netbox /bin/bash
#The container has no PIP but does have curl and python preinstalled
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
#..and install the text editor required for the next steps.
pip install pyvim

After this, you can follow the instructions from the page like (aio):

source /opt/netbox/venv/bin/activate
pip install netbox-acls netbox-topology-views netbox-config-diff netbox-interface-synchronization netbox-routing netbox-security netbox-validity netbox-plugin-dns netbox-contract netbox-secrets
## edit the file // different file 
pyvim /etc/netbox/config/plugins.py 
# submit the following
PLUGINS=["netbox_acls","netbox_topology_views","netbox_config_diff","netbox_interface_synchronization","netbox_routing","netbox_security","validity","netbox_dns","netbox_contract","netbox_secrets"]
PLUGINS_CONFIG = {
    "netbox_config_diff": {
        "USERNAME": "foo", # define here your RADIUS/TACACS username 
        "PASSWORD": "bar", # define here your RADIUS/TACACS password 
        "AUTH_SECONDARY": "foobar",  # define here password for accessing Privileged EXEC mode, this variable is optional
        "PATH_TO_SSH_CONFIG_FILE": "/home/.ssh/config",  # define here PATH to SSH config file, it will be used for device connections, this variable is optional
    },
}
## similar to vim save the file and exit using :wq
python3 /opt/netbox/netbox/manage.py migrate
python3 /opt/netbox/netbox/manage.py collectstatic
## If error, the configuration.py file has not been edited correctly.
## Exit the container
exit
## Restart the container
docker restart netbox  

All the plugins from this list should be active.

asciicast

Troubleshooting

To view logs:

docker compose logs -f netbox
docker compose logs -f tailscale