TiloBox
Back to directory
Headscale project preview

Headscale

An open-source, self-hosted implementation of the Tailscale coordination server.

LicenseBSD-3-Clause
GitHub stars43.1k
Last commit1 months ago
Tags7 topics
WireguardMesh VpnNetworkingSelf HostedTailscaleVpnGolang
Overview

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.

Guided learning

Learn Headscale by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

3 min read 11 sections
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

yaml
1version: '3.7'
2
3services:
4 headscale:
5 image: headscale/headscale:latest
6 container_name: headscale
7 restart: unless-stopped
8 volumes:
9 - ./config:/etc/headscale
10 - ./data:/var/lib/headscale
11 ports:
12 - "8080:8080" # Web API & DERP
13 - "9087:9087" # Metrics
14 command: headscale serve

Create config/config.yaml with your server domain:

yaml
1server_url: http://headscale.example.com:8080
2listen_addr: 0.0.0.0:8080
3metrics_listen_addr: 0.0.0.0:9087
4db_type: sqlite3
5db_path: /var/lib/headscale/db.sqlite
6ip_prefixes:
7 - fd7a:115c:a1e0::/48
8 - 100.64.0.0/10
9derp:
10 server:
11 enabled: true
12 region_id: 999
13 region_code: "headscale"
14 region_name: "Headscale Embedded DERP"

Start the service:

bash
1docker compose up -d

Connecting a Client Device

bash
1# 1. Create a user namespace on Headscale
2docker exec headscale headscale users create alice
3
4# 2. On your client machine, point the official Tailscale client to Headscale
5tailscale up --login-server http://headscale.example.com:8080
6
7# 3. Register the generated node key printed in the terminal
8docker 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

Related tools

More options with a similar category or technology profile.

Headscale FAQs

Headscale is listed as a Devops Infrastructure tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository and official website for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

Headscale is listed under the BSD-3-Clause license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

Headscale is listed as an alternative to Tailscale. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.