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.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install d339dece-3530-11f1-9bc6-00163e2b0d79 --target codex先 dry-run,确认写入项后再运行此命令。
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.
常见问题
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.
引用来源 (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
讨论
相关资产
Coturn — Open Source TURN and STUN Server for WebRTC
A free, open-source TURN and STUN server implementation that provides NAT traversal for WebRTC, VoIP, and real-time communication applications.
EspoCRM — Open-Source CRM Platform for Sales and Support Teams
EspoCRM is a self-hosted customer relationship management application with lead tracking, email integration, calendar, and workflow automation — fully customizable through an admin panel.
Flatnotes — Self-Hosted Database-Free Markdown Notes
Flatnotes is a lightweight, self-hosted note-taking web app that stores notes as plain Markdown files in a flat folder — no database required, with full-text search and TOTP authentication.
Cinny — Self-Hosted Matrix Client for Encrypted Chat
Cinny is a sleek, open-source Matrix client with end-to-end encryption, custom themes, and full self-hosting support for private team communication.