heyer.systems Open Source

NetBird

Self-hosted NetBird control plane: management, signal, relay, STUN, embedded identity provider and dashboard for a WireGuard-based zero-trust network.

Install

On the Proxmox node as root:

bash -c "$(curl -fsSL https://iac.heyer.systems/netbird/ct.sh)"

Container from the Debian 13 template · default: 2 CPU, 3072 MiB RAM, 10 GiB disk

Customise the commandYour own values for CPU, RAM, network and modules – no dialog

Then: Behind an HTTPS reverse proxy for netbird_domain → http://<IP>:80 (gRPC paths as h2c), UDP 3478 forwarded to <IP>. Login: netbird_admin_email (default admin@<domain>), password in the guest: grep netbird_admin_password /etc/iac/settings.env

More steps are needed outside the guest – see the setup guide.

Settings per instance

SettingMeaning
netbird_domainPublic domain – Host name the HTTPS reverse proxy serves, e.g. netbird.example.org (without https://).
netbird_portPublic HTTPS port – Port of the reverse proxy for NetBird: 443 (default) or e.g. 8443 for an entrypoint of its own.
netbird_admin_emailAdministrator e-mail – Login of the first administrator; default admin@<domain>.

When creating a container, as var_<setting>:

var_netbird_domain="<value>" bash -c "$(curl -fsSL https://iac.heyer.systems/netbird/ct.sh)"

Set or change later, in the guest (for VMs the only way so far): a line netbird_domain=<value> in /etc/iac/settings.env – no quotes, the last line of a setting wins – then:

update

With NetBox: the same line netbird_domain=<value> in the field Settings of the VM – it takes effect at the next update. Secrets stay in the guest.

Missing or empty = the app's default. Do not edit the configuration files iac writes – update overwrites them; their first lines name the file for local changes.

Setup guide

NetBird needs a few things outside the guest: a public domain, an HTTPS reverse proxy in front of the guest and two port forwardings. This guide sets them up with Traefik on a port of its own (8443) – the setup this app is tested with. The guest itself only speaks HTTP.

peers / browser ──HTTPS :8443──▶ router ──▶ Traefik (entrypoint "netbird") ──HTTP/h2c :80──▶ NetBird guest
peers ──────────STUN UDP :3478─▶ router ──────────────────────────────────────────────────▶ NetBird guest

Before you start

WhatExample
Public domainnetbird.example.org, an A record to your public IP
HTTPS reverse proxyTraefik (e.g. iac-traefik) with a certificate resolver
Port forwardings on the router8443/tcp → Traefik, 3478/udp → NetBird guest

Port 443 or a port of its own? Peers keep gRPC streams open for hours. Traefik ends requests after 60 s by default (readTimeout) and sets timeouts only per entrypoint. A separate entrypoint for NetBird keeps that protection for all other services on 443. The price: some hotel and company networks only allow 443 outbound. To run NetBird on 443, leave netbird_port empty and set the timeouts below on your 443 entrypoint instead – for every service on it.

Cloudflare: set the record to DNS only (grey cloud). Peers reach STUN (UDP 3478) under the same name, and the Cloudflare proxy does not pass UDP.

1. Create the guest

On the Proxmox node:

var_netbird_domain=netbird.example.org var_netbird_port=8443 \
  bash -c "$(curl -fsSL https://iac.heyer.systems/netbird/ct.sh)"

The first installation builds the server and the dashboard from source – a few minutes. Note the IP of the guest, Traefik needs it.

For a VM (vm.sh) the settings go into the guest afterwards – add to /etc/iac/settings.env:

netbird_domain=netbird.example.org
netbird_port=8443

then run update in the guest.

Without netbird_domain the guest answers only on 127.0.0.1 – the services run, but no peer or browser can log in.

2. Router and firewall

ForwardingToWhy
8443/tcpTraefikdashboard, API, gRPC, relay, login
3478/udpNetBird guestSTUN – peers find their public address

The guest opens 80/tcp for private networks only (Traefik) and 3478/udp for everyone; all other ports stay closed.

On the Traefik guest, iac only opens 80, 443 and 8080. Open 8443 in /etc/nftables.d/90-local.nft:

echo 'add rule inet iac input tcp dport 8443 accept comment "Traefik entrypoint netbird"' \
  >>/etc/nftables.d/90-local.nft
nft -c -f /etc/nftables.conf && systemctl reload nftables

3. Traefik

Entrypoint

In the static configuration (with iac-traefik: your own /etc/traefik/traefik.local.yaml, it replaces the iac default completely):

entryPoints:
  netbird:
    address: ":8443"
    http:
      middlewares:
        - iac-security-headers@file
    transport:
      respondingTimeouts:
        readTimeout: 0
        writeTimeout: 0

idleTimeout keeps its default: idle keep-alive connections are still closed, only running streams may last. Restart Traefik after the change: systemctl restart traefik.

Routers

A file for the dynamic configuration, e.g. /etc/traefik/conf.d/netbird.yaml – domain, guest IP and the name of your certificate resolver adjusted. gRPC goes to the guest as h2c (HTTP/2 without TLS), everything else as HTTP:

http:
  routers:
    netbird-grpc:
      rule: Host(`netbird.example.org`) && (PathPrefix(`/signalexchange.SignalExchange/`) || PathPrefix(`/management.ManagementService/`) || PathPrefix(`/management.ProxyService/`))
      entryPoints: [netbird]
      service: netbird-h2c
      priority: 100
      tls:
        certResolver: letsencrypt
    netbird:
      rule: Host(`netbird.example.org`)
      entryPoints: [netbird]
      service: netbird-http
      tls:
        certResolver: letsencrypt
  services:
    netbird-h2c:
      loadBalancer:
        servers:
          - url: "h2c://192.0.2.10:80"
    netbird-http:
      loadBalancer:
        servers:
          - url: "http://192.0.2.10:80"

Traefik reads the file at once. With a DNS challenge the certificate for the new name follows within a minute (journalctl -u traefik -f).

Other reverse proxies

The guest routes like the official nginx template of NetBird. Your proxy only has to tell gRPC from the rest: /signalexchange.SignalExchange/, /management.ManagementService/ and /management.ProxyService/ as gRPC (h2c) to http://<guest>:80, everything else – including the WebSockets /relay and /ws-proxy/ – as HTTP to the same address, with long read timeouts for both. nginx:

location ~ ^/(signalexchange\.SignalExchange|management\.ManagementService|management\.ProxyService)/ {
    grpc_pass grpc://192.0.2.10:80;
    grpc_read_timeout 1d;
    grpc_send_timeout 1d;
}
location / {
    proxy_pass http://192.0.2.10:80;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto https;
    proxy_read_timeout 1d;
}

4. First login

Open https://netbird.example.org:8443.

  • Login: netbird_admin_email, default admin@<domain>
  • Password, in the guest: grep netbird_admin_password /etc/iac/settings.env

There is no setup wizard: iac creates this administrator over the setup API on 127.0.0.1, and the guest refuses /api/setup from the network – nobody else can claim the instance. Change the password in the dashboard afterwards; iac never touches it again.

5. Connect peers

In the dashboard: Setup Keys → Create Setup Key. On every device with the NetBird client:

netbird up --management-url https://netbird.example.org:8443 --setup-key <SETUP-KEY>
netbird status

Leave out :8443 when NetBird runs on 443. Desktop and mobile apps take the same address under Settings → Management URL; they then log in with a user of the dashboard instead of a key.

6. Check it

In the guest:

bash /var/lib/iac/src/core/bin/iac-smoke

It checks the services, the administrator login, the closed setup API, gRPC through nginx and the firewall. From outside, through Traefik:

curl -fsS https://netbird.example.org:8443/api/instance                  # {"setup_required":false}
curl -fsS https://netbird.example.org:8443/oauth2/.well-known/openid-configuration | jq .issuer

The issuer must be exactly https://netbird.example.org:8443/oauth2 – with the port when you use one.

Updates and the way back

update builds a new version in the guest. Before it switches, it stops the server for a moment and backs up /var/lib/netbird to /var/lib/netbird-backup/netbird-<old version>-<time>.tar.gz (the three newest stay): the new version migrates its database when it starts, and there is no way back without that copy.

Back to the previous version:

systemctl stop netbird-server
find /var/lib/netbird -mindepth 1 -delete
tar -xzf /var/lib/netbird-backup/netbird-<old>-<time>.tar.gz -C /var/lib/netbird
ln -sfn /opt/netbird/releases/server-<old> /opt/netbird/server
systemctl start netbird-server

Troubleshooting

SymptomCause
Peers reconnect about every minutethe entrypoint still has the 60 s readTimeout – see Traefik
Login page loops back, or “invalid redirect URI”netbird_domain / netbird_port do not match the address in the browser – fix them in /etc/iac/settings.env, then update
Dashboard loads, but stays empty or “unauthorized”the gRPC or API paths do not reach the guest – check the router order and the h2c service
Peers only connect through the relay3478/udp is not forwarded to the guest
Certificate error on :8443the router of the netbird entrypoint has no certResolver, or the DNS record is proxied

Logs: journalctl -u netbird-server in the guest, journalctl -u traefik on the proxy.

Source: docs/GUIDE.md of iac-netbird – corrections welcome.

Update

In the guest:

update

Debian packages, NetBird, modules and the iac configuration. Major versions never change automatically.

Add modules – any time, in containers and VMs alike:

update --list-modules
update --add-modules node-exporter

All modules · More about update