Stop Using Tailscale. Use Open Source Instead

⏱ ~11 min 🎤 DevOps Toolbox 🏷 Headscale 🏷 Tailscale 🏷 WireGuard 🏷 Self-Hosting

Tailscale makes mesh VPN networking dead simple — but it routes your coordination through their servers and locks you into their control plane. Headscale is an open-source, self-hosted implementation of the Tailscale coordination server. You get the same WireGuard-based mesh networking, the same Tailscale clients, but with full control over your infrastructure. This guide walks through replacing Tailscale's managed service with a self-hosted Headscale instance, including DERP relay setup and ACL configuration.

01

Why Replace Tailscale

0:00

Tailscale is excellent software, but there are legitimate reasons to self-host your coordination server:

  • Data sovereignty — your network topology and device metadata stays on your infrastructure, not Tailscale's servers
  • Vendor independence — no risk of pricing changes, policy shifts, or service discontinuation
  • Compliance — some organizations require that all control-plane infrastructure be self-hosted
  • Learning — understanding how mesh VPN coordination works under the hood

"Tailscale the product is great. But Tailscale the company controls your network's coordination layer. Headscale gives that control back to you."

02

VPN vs Mesh / WireGuard Primer

1:26

Traditional VPNs use a hub-and-spoke model: all traffic routes through a central server. This adds latency and creates a single point of failure. Mesh VPNs are different — every node connects directly to every other node using peer-to-peer WireGuard tunnels.

  • WireGuard — the underlying encryption protocol. Fast, modern, built into the Linux kernel. Handles the actual encrypted tunnels.
  • Coordination server — distributes public keys and endpoints so nodes can find each other. This is what Tailscale (and Headscale) provides.
  • DERP relays — fallback relay servers for when direct peer-to-peer connections can't be established (strict NATs, firewalls).

The key insight: Tailscale/Headscale don't carry your traffic. They only coordinate the mesh. Actual data flows directly between your nodes over WireGuard.

03

Headscale Setup

3:00

Headscale runs on a single server that acts as your coordination point. Installation can be done via package manager or Docker:

# Install Headscale (Debian/Ubuntu) wget https://github.com/juanfont/headscale/releases/latest/download/headscale_amd64.deb sudo dpkg -i headscale_amd64.deb # Or via Docker docker run -v /etc/headscale:/etc/headscale \ -p 8080:8080 -p 9090:9090 \ headscale/headscale serve

The configuration file (/etc/headscale/config.yaml) defines your server URL, database backend (SQLite for small setups), IP prefix ranges, and DNS settings. Most defaults are sensible — you mainly need to set the server_url to your domain.

# /etc/headscale/config.yaml (key settings) server_url: https://headscale.yourdomain.com listen_addr: 0.0.0.0:8080 ip_prefixes: - 100.64.0.0/10 dns: magic_dns: true base_domain: mesh.local
04

DERP Server

5:00

DERP (Designated Encrypted Relay for Packets) is a fallback relay for when two nodes can't establish a direct WireGuard connection — typically due to restrictive NATs or corporate firewalls. Tailscale operates global DERP servers; with Headscale, you can either use Tailscale's public DERP servers or run your own.

Running your own DERP server ensures complete independence from Tailscale's infrastructure:

# Run a custom DERP server go install tailscale.com/cmd/derper@latest # Start the DERP relay derper --hostname=derp.yourdomain.com \ --certmode=letsencrypt \ --verify-clients

Configure Headscale to use your custom DERP server by defining a DERP map in the configuration. Most home and cloud networks can establish direct connections, so DERP is truly a fallback — but having it ensures 100% connectivity.

05

Client Configuration

6:30

The best part about Headscale: you use the official Tailscale clients. No custom software needed. You just point them at your Headscale server instead of Tailscale's:

# Create a user in Headscale headscale users create myuser # Generate a pre-auth key headscale preauthkeys create --user myuser # On the client machine, use standard Tailscale client tailscale up --login-server https://headscale.yourdomain.com \ --authkey YOUR_PREAUTH_KEY

This works on Linux, macOS, Windows, iOS, and Android — all using the official Tailscale app. The only change is the --login-server flag pointing to your Headscale instance.

"You don't need special clients. The official Tailscale apps work perfectly with Headscale. Just change the login server URL."

06

ACLs & Security

8:00

Access Control Lists (ACLs) define who can talk to whom in your mesh network. Headscale supports Tailscale's ACL policy format — a JSON/YAML file that defines fine-grained network access rules:

// Example ACL policy { "acls": [ { "action": "accept", "src": ["group:devs"], "dst": ["tag:server:*"] }, { "action": "accept", "src": ["group:admins"], "dst": ["*:*"] } ] }
  • Groups — organize users into logical groups (devs, admins, contractors)
  • Tags — label machines by role (server, database, monitoring)
  • Granular ports — restrict access to specific ports, not just hosts
  • Default deny — if no ACL rule matches, traffic is blocked
07

Final Thoughts

10:00

Headscale isn't for everyone. If you want zero operational overhead, Tailscale's managed service is still excellent. But if you value data sovereignty, need compliance guarantees, or simply enjoy self-hosting — Headscale gives you the same mesh VPN experience with full control.

  • Use Tailscale if: You want managed simplicity, don't mind the control plane being external, and value their UI/admin console
  • Use Headscale if: You need data sovereignty, self-hosting is a requirement, or you want to learn the internals
  • Both use: The same WireGuard tunnels, the same Tailscale clients, the same mesh networking model

"Headscale doesn't replace Tailscale the protocol — it replaces Tailscale the service. You get the same mesh magic, just on your own terms."

✦ Key Takeaways

1 Headscale is a self-hosted, open-source replacement for Tailscale's coordination server — same protocol, same clients, your infrastructure.
2 The coordination server only handles key exchange and peer discovery — actual traffic flows directly between nodes via WireGuard.
3 Official Tailscale clients work with Headscale — just change the --login-server URL. No special software needed.
4 Self-host a DERP relay for complete independence from Tailscale's infrastructure — ensures connectivity through restrictive NATs.
5 ACL policies provide fine-grained access control with groups, tags, and per-port rules — default-deny security model.