Headscale — Open Source Self-Hosted Tailscale Control Server
Headscale is an open-source implementation of the Tailscale control server. Run your own private mesh VPN with WireGuard, no Tailscale subscription needed.
What it is
Headscale is an open-source implementation of the Tailscale control server (coordination server). Tailscale clients connect to Headscale instead of Tailscale's SaaS control plane, giving you a fully self-hosted WireGuard mesh VPN. Devices authenticate, exchange keys, and establish encrypted peer-to-peer connections through your own server.
It targets privacy-conscious users, organizations with data sovereignty requirements, and anyone who wants Tailscale's ease of use without depending on a third-party coordination service.
How it saves time or tokens
Setting up a traditional VPN (OpenVPN, WireGuard manually) requires configuring each peer, managing key distribution, and maintaining routing tables. Headscale with Tailscale clients automates all of this. Devices join the network by authenticating against Headscale, and the mesh topology is managed automatically.
The Tailscale client handles NAT traversal, so devices behind firewalls can connect directly without port forwarding. This removes the common pain point of VPN setup for remote workers and distributed teams.
How to use
- Deploy Headscale on a server with a public IP. Install from the package repository or run with Docker. Configure the
config.yamlwith your domain name and authentication settings. - Install the Tailscale client on each device. Point it to your Headscale server:
tailscale up --login-server https://headscale.example.com. - Authenticate the device from the Headscale server, and it joins the mesh VPN. All connected devices can reach each other over encrypted WireGuard tunnels.
Example
# Deploy Headscale with Docker
docker run -d --name headscale \
-p 8080:8080 -p 9090:9090 \
-v headscale-data:/var/lib/headscale \
-v headscale-config:/etc/headscale \
headscale/headscale:latest serve
# Create a user (namespace)
docker exec headscale headscale users create myuser
# On a client device, connect to your Headscale server
tailscale up --login-server https://headscale.example.com
# Approve the device on the server
docker exec headscale headscale nodes register \
--user myuser --key nodekey:abc123...
# Check connected nodes
docker exec headscale headscale nodes list
Related on TokRepo
- AI tools for security — VPN and zero-trust networking tools
- AI tools for self-hosted — Self-hosted infrastructure alternatives
Common pitfalls
- Not configuring HTTPS for the Headscale server. Tailscale clients require a secure connection to the control server. Place Headscale behind a reverse proxy with a valid TLS certificate (Let's Encrypt works well).
- Forgetting to open the required ports. Headscale needs its HTTP/gRPC port accessible to clients. The Tailscale clients also need UDP port 41641 for direct WireGuard connections between peers.
- Running an outdated Headscale version with a newer Tailscale client. Headscale tracks Tailscale's protocol changes. Version mismatches can cause connection failures. Keep both Headscale and Tailscale clients reasonably up to date.
Frequently Asked Questions
Headscale replaces only the control server (coordination server) component. The Tailscale clients (which handle WireGuard tunnels, NAT traversal, and DNS) remain the same. The difference is that your Headscale server manages authentication and key exchange instead of Tailscale's cloud service. You lose some Tailscale SaaS features like admin console and SSO integration.
Yes. Headscale supports OpenID Connect (OIDC) authentication, allowing users to log in with providers like Google, Microsoft, Okta, or Keycloak. This replaces the manual node registration workflow with a web-based login flow.
Headscale is designed for small-to-medium deployments. It handles hundreds of devices well. The coordination server is lightweight since it only manages key exchange and node registration. The actual data traffic flows directly between peers via WireGuard.
Yes. Headscale supports Tailscale's ACL policy format for controlling which devices can communicate with each other. Define ACL rules in a JSON or YAML policy file to restrict access between users, groups, and specific ports.
Yes. Headscale supports MagicDNS, which provides DNS names for all devices in the mesh network. Access devices by name (e.g., laptop.your-domain) instead of IP addresses. Configure the base domain in Headscale's config file.
Citations (3)
- Headscale GitHub Repository— Headscale is an open-source implementation of the Tailscale control server
- Tailscale Architecture Blog— Tailscale uses WireGuard for encrypted peer-to-peer mesh networking
- Headscale Configuration Documentation— Headscale supports OIDC authentication and Tailscale ACL policies
Related on TokRepo
Discussion
Related Assets
Conda — Cross-Platform Package and Environment Manager
Install, update, and manage packages and isolated environments for Python, R, C/C++, and hundreds of other languages from a single tool.
Sphinx — Python Documentation Generator
Generate professional documentation from reStructuredText and Markdown with cross-references, API autodoc, and multiple output formats.
Neutralinojs — Lightweight Cross-Platform Desktop Apps
Build desktop applications with HTML, CSS, and JavaScript using a tiny native runtime instead of bundling Chromium.