selfhostedops-stack/mesh
2026-10-25 10:33:27 +01:00
..
clients Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00
headscale Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00
measurements Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00
netbird Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00
acltest.sh Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00
perf.sh Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00
README.md Episode 20: NetBird vs Headscale mesh VPN measurements 2026-10-25 10:33:27 +01:00

Mesh VPN, measured (episode 20)

Self-hosted NetBird 0.81.3 against Headscale 0.29.6 with the official Tailscale client 1.104.2, each installed on its own fresh 2 vCPU / 4 GB cloud server (Debian 13), measured with the same two peers, then removed. Both VPNs never ran at the same time.

The Tailscale cloud service was not tested. Everything about Tailscale here is the official client talking to a self-hosted Headscale server. What carries over to the cloud service is only taken from official documentation and kept apart in measurements/70-headscale-vs-tailscale-doku.txt.

The NetBird that runs next to the stack since episode 5 is in ../netbird/. It was not touched for this episode; this folder is a separate lab with the vendor's standalone install.

Setup

  • Control servers: one cloud server per product, official install path only.
    • NetBird: the getting-started.sh script (three containers: netbird-server, dashboard, traefik).
    • Headscale: the official DEB package (one systemd service) plus four changed config lines.
  • Peer A: a VM in a home network behind NAT (endpoint dependent mapping, so hole punching has to work for real).
  • Peer B: a cloud server with a public IPv4 address.
  • Clients: containers with pinned versions, netbirdio/netbird:0.81.3 and tailscale/tailscale:v1.104.2 (kernel TUN, WireGuard in Go).
  • TLS: sslip.io names of the server IPs, Let's Encrypt via the products' own mechanisms.
  • Relay forced: UDP between the two peers' public addresses dropped with iptables on both peers.
Part Version
NetBird server (management, signal, relay combined) netbirdio/netbird-server:latest = 0.81.3
NetBird dashboard netbirdio/dashboard:latest = v2.95.0
Traefik (written by the NetBird script) v3.7.14
NetBird client netbirdio/netbird:0.81.3
Headscale 0.29.6, official DEB package
Tailscale client tailscale/tailscale:v1.104.2
iperf3 3.18 (Debian 13)

NetBird 0.81.4 was released during the lab. The script writes :latest for server and dashboard, so a later docker compose pull would have pulled it unasked. Pin the tags before you run it.

Files

  • netbird/: script call (README.txt) and the files the script generated: docker-compose.yml, config.yaml, dashboard.env (saved as dashboard.env.example). Generated secrets are replaced with <generated-by-getting-started.sh>.
  • headscale/: package install (README.txt), the full config.yaml as used in the first run, config-aenderungen.txt with the changed lines (four for the default run, three more for the built-in DERP relay) and policy.hujson for the ACL test.
  • clients/README.txt: the docker run commands for both clients. Keys come from an env file.
  • perf.sh: 100 pings, then 3 x 20 s iperf3 in each direction, with pidstat on the VPN process and sar on the whole system of peer A.
  • acltest.sh: ping, TCP 22 and TCP 5201 from one peer to the other.
  • measurements/: raw output of every measurement quoted in the video. Comments in the scripts and notes are German.

Reproduce

  1. Two control servers, two peers (one behind a home NAT, one with a public IP), iperf3 and sysstat on both peers, iperf3 -s on peer B.
  2. Install NetBird with the script call from netbird/README.txt, create the first admin on /setup right away, create a setup key, start the NetBird client on both peers (clients/README.txt).
  3. On peer A: ./perf.sh <netbird-ip-of-B> netbird. Then drop UDP between the peers' public addresses on both sides and run it again for the relay path.
  4. Stop the NetBird clients, install Headscale from the DEB package, apply the lines from headscale/config-aenderungen.txt, create a pre-auth key, start the Tailscale client on both peers, then ./perf.sh <tailnet-ip-of-B> tailscaled direct and with UDP dropped.
  5. For the outage tests stop the control server (docker compose stop or systemctl stop headscale) while a ping runs, then restart one client.

Without a baseline you cannot read the numbers: run ./perf.sh <public-ip-of-B> - without any tunnel first (measurements/30-basis-ohne-tunnel.txt).

Results

Download means B to A (iperf3 -R), receiver values. One run per measurement with three iperf3 runs, one home line, one NAT type, one data center. The home upload varies a lot, so upload differences between the two are not reliable; download is.

NetBird Headscale + Tailscale client File
Install, command to service ready 9.1 s, 3 containers 5.1 s, 1 process 10, 20
Peer behind NAT joins, start to first ping reply 2.9 s 4.0 s 11, 21
Public ports TCP 80, 443, UDP 3478 TCP 80, 443 (plus UDP 3478 with built-in DERP) 12, 22, 37, 52
Idle RAM, ps RSS 253 MiB 57 MiB 12, 22
Ping direct, mean of 100 26.8 ms 27.1 ms 31, 33
Download direct (no tunnel: 806 to 859 Mbit/s) 589 to 593 Mbit/s 803 to 815 Mbit/s 30, 31, 33
System CPU on peer A under load 17.3 % 26.0 % 31, 33
Own relay on the same server, upload 45 to 52 Mbit/s 12 to 13 Mbit/s 37, 38
Own relay on the same server, download 121 to 129 Mbit/s 13 to 63 Mbit/s 37, 38
Back to direct after the UDP block is lifted stayed on relay for 27 min and 10 min, client restart fixed it 3 to 4 s 35, 36, 37, 38
Control server off for 10 min, running tunnel 1 of about 617 pings lost 0 of 612 lost 40, 41
Client restarted while server is off no peers logged out 40, 41
Default access rule "Default", all to all no policy, everything allowed 50, 51
Rule "A to B only TCP 22", ping blocked answered 50, 51
Removing a peer until the tunnel is dead 0.28 s after the click 1.03 s after the command 60, 61
Key expiry by default peer login expiry 24 h none 12, 61, 70

Notes on the findings:

  • NetBird stays on the relay. After three failed ICE attempts the client logs ICE retries exhausted (3/3), switching to hourly retry. If the direct path is broken longer than that, it stays relayed until the next hourly retry, a network change event or a restart (measurements/38). Whether the hourly retry brings it back was not waited for.
  • Headscale relays through Tailscale's DERP servers by default. The example config loads https://controlplane.tailscale.com/derpmap/default and keeps the built-in DERP off (measurements/21, 34). Traffic stays end to end encrypted, but takes a path you do not run. The public DERP path in measurements/34 is shared infrastructure and not a benchmark of it; the fair comparison is the built-in DERP against NetBird's relay on the same server (measurements/37, 38). Why the built-in DERP was this slow is not resolved: neither the lines nor the server CPU were the limit.
  • Port rule plus ping. With only TCP 22 allowed, the Tailscale client still answers ping. The client source says so (wgengine/filter/filter.go: "If any port is open to an IP, allow ICMP to it."), so this is client behaviour and not Headscale specific (measurements/50).
  • First come, first admin. After the NetBird script, GET /api/instance answers {"setup_required":true} publicly and anyone who reaches the URL can create the owner account on /setup (measurements/10). Headscale has no web interface.
  • Kernel WireGuard was not faster. NetBird used kernel WireGuard (0.1 % process CPU) but reached only about 590 Mbit/s download while the line delivered 845 to 922 Mbit/s without tunnel at the same time. The cause is open (measurements/31).
  • NetBird connects lazily. 0.81.3 has Lazy connection: true: peers show 0/1 Connected and Idle until traffic flows (measurements/11).

Not measured: the Tailscale cloud service, mobile clients, brute force protection of the NetBird login, Headscale RAM per cgroup with connected peers.

Public addresses are replaced with documentation ranges (203.0.113.10 is peer A's home line, 198.51.100.0/24 the cloud servers), host names with peer-a, peer-b, peer-c, nb-server and hs-server. Tunnel addresses from 100.64.0.0/10 are the real ones. All servers of this lab are deleted, so none of the addresses or keys exist any more.