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
讨论
相关资产
Documenso — Open Source Document Signing Platform
Documenso is an open-source DocuSign alternative for self-hosted document signing with PDF e-signatures, audit trails, and Next.js stack.
Authentik — Open Source Identity Provider & SSO Platform
Authentik is a flexible open-source identity provider with SSO, MFA, user enrollment flows, and application proxy — the authentication glue for your self-hosted stack.
Mattermost — Open Source Slack Alternative for Team Collaboration
Mattermost is an open-source messaging platform for secure team collaboration. Channels, threads, voice/video calls, playbooks, and integrations — self-hosted Slack alternative.
Istio — Open Source Service Mesh for Microservices
Istio is the leading open-source service mesh. Connect, secure, control, and observe services with mTLS encryption, traffic management, and observability — all without changing application code.