Headscale
An open-source, self-hosted implementation of the Tailscale coordination server.
Why consider Headscale?
Headscale is an open-source coordination server for Tailscale WireGuard mesh networks. It lets you create secure private overlay networks across devices without vendor lock-in.
Learn Headscale by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide11 sections
What is Headscale?
Headscale is an open-source, self-hosted implementation of the Tailscale coordination server written in Go. It operates as an independent, private alternative to Tailscale's proprietary SaaS control plane.
With Headscale, you can build secure, decentralized WireGuard mesh virtual private networks (overlay networks) that seamlessly interconnect laptops, mobile phones, cloud servers, and home servers. Every device receives a stable private IP address and connects peer-to-peer with encrypted WireGuard tunnels without routing traffic through third-party servers.
Who Is It For?
- Sysadmins & DevOps Teams: Interconnecting geographically distributed multi-cloud VPS instances, on-premises servers, and developer workstations into a flat, private encrypted mesh network.
- Privacy-Conscious Users: Benefiting from Tailscale's zero-configuration WireGuard mesh ergonomics while keeping network topologies and cryptographic keys on private servers.
- Homelab Enthusiasts: Accessing home lab servers, NAS storage, and internal web services securely from anywhere without opening public router ports.
Key Features
- 100% compatible with official Tailscale client applications on Linux, macOS, Windows, Android, and iOS.
- Full peer-to-peer WireGuard mesh networking: Encrypted direct device-to-device communication with NAT traversal (STUN/DERP).
- MagicDNS support: Automatic internal domain name resolution for all connected nodes (e.g.
node1.my-network.example.com). - Exit Node support: Route all device internet traffic securely through a designated server node.
- OIDC Single Sign-On integration: Authenticate nodes via Authentik, Keycloak, or Google Workspace.
Deploying Headscale with Docker Compose
version: '3.7'services: headscale: image: headscale/headscale:latest container_name: headscale restart: unless-stopped volumes: - ./config:/etc/headscale - ./data:/var/lib/headscale ports: - "8080:8080" # Web API & DERP - "9087:9087" # Metrics command: headscale serveCreate config/config.yaml with your server domain:
server_url: http://headscale.example.com:8080listen_addr: 0.0.0.0:8080metrics_listen_addr: 0.0.0.0:9087db_type: sqlite3db_path: /var/lib/headscale/db.sqliteip_prefixes: - fd7a:115c:a1e0::/48 - 100.64.0.0/10derp: server: enabled: true region_id: 999 region_code: "headscale" region_name: "Headscale Embedded DERP"Start the service:
docker compose up -dConnecting a Client Device
# 1. Create a user namespace on Headscaledocker exec headscale headscale users create alice# 2. On your client machine, point the official Tailscale client to Headscaletailscale up --login-server http://headscale.example.com:8080# 3. Register the generated node key printed in the terminaldocker exec headscale headscale nodes register --user alice --key <NODE_MACHINE_KEY>Practical Use Cases
1. Cross-Cloud Encrypted Overlay Network
A company interconnects 20 AWS EC2 nodes, 10 Hetzner dedicated servers, and local office workstations into a secure 100.64.0.0/10 mesh network without maintaining complex site-to-site IPsec tunnels.
2. Secure Remote Home Lab Access
A user connects an iPhone to Headscale, accessing home Nextcloud and Home Assistant servers via private IP without exposing ports on the public router.
3. Remote Server Secure Exit Node
A traveler routes mobile device web traffic through a home server configured as a Headscale Exit Node (tailscale up --exit-node=home-server), securing public hotel Wi-Fi connections.
Troubleshooting and Limitations
- NAT Traversal & DERP: If direct peer-to-peer UDP connections fail between restrictive firewalls, ensure Headscale's embedded DERP server or public DERP map is reachable to relay encrypted traffic.
- Client Login URL Flags: Newer Tailscale client releases on iOS/macOS require configuring the custom login server via Mobile Configuration Profiles or the app alternate login screen.
Official Resources
- Official Website: https://headscale.net
- GitHub Repository: https://github.com/juanfont/headscale
- Documentation: https://headscale.net/docs/
Related tools
More options with a similar category or technology profile.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
bpytop
Python port of bashtop with game-like UI, responsive mouse support, and hardware sensors.
bashtop
Linux resource monitor showing usage and stats for processor, memory, disks, network, and processes.
SchemaHero
Kubernetes-native declarative database schema management and table migration operator.