Headscale and Tailscale
Self-hosted VPN using Headscale v0.28.0 as control server and Tailscale as client
Overview¶
This documentation covers the setup and usage of Headscale — a self-hosted implementation of the Tailscale control server running on k3s. Once configured, team members can access private servers from anywhere in the world by simply turning on their Tailscale client, similar to connecting to the castisthai WiFi network.
How It Works¶
Your Computer (Tailscale ON)
↓
Headscale Server
(headscale.castis.io)
↓
nuc-b (<NUC_B_TAILSCALE_IP> / <NUC_B_LAN_IP>)
↓ subnet routing
├── nuc-a (<NUC_A_LAN_IP>)
├── other device (<OFFICE_LAN_HOST_IP>)
└── ... (any host in <OFFICE_LAN_CIDR>)
Accessible Servers¶
| Server | Tailnet IP | Local IP | Tailscale Installed | Access Method |
|---|---|---|---|---|
| nuc-a | — | No | SSH via local IP (routed through nuc-b) | |
| nuc-b | Yes | SSH via Tailnet IP, local IP, or MagicDNS | ||
| Other subnet devices | — | any host in |
No | SSH via local IP (routed through nuc-b) |
nuc-b acts as the subnet router for the entire
<OFFICE_LAN_CIDR>network. All devices in this subnet are reachable as long as nuc-b is online and connected to Headscale.
Documents¶
1. Headscale Server Implementation¶
For DevOps / administrators setting up the Headscale server on k3s
Covers installation and configuration of the Headscale control server including: - k3s node preparation and storage setup - Deploying Headscale as a StatefulSet - TLS certificate via cert-manager and Let's Encrypt - APISIX ingress routing with WebSocket support - Post-install user and node management - Subnet routing configuration - Troubleshooting common issues
2. Tailscale Client Installation¶
For team members who want to connect to the private network
Covers installing and connecting Tailscale on your device including: - Installation on macOS, Linux, and Windows - Connecting to the Headscale server - Accessing servers via SSH - Managing your connection - Subnet routing for private network access
3. User Isolation Setup¶
For administrators restricting cross-user visibility on the tailnet
Covers configuring Headscale ACLs so users can only see and reach the nodes they're authorized for, instead of the entire tailnet.
Quick Start for Team Members¶
If you just want to connect and access servers:
- Go to Tailscale-client
- Install Tailscale for your OS
- Connect using the preauth key (get from admin)
- SSH to any server in the table above