Build Tailscale
KINDAreplaces $8/mosaves $96/yrback to the verdict
Your own Tailscale control plane: headscale on a VPS behind Caddy, the official Tailscale clients pointed at it, MagicDNS and a deny-by-default ACL, an embedded relay and an exit node, and a restore you performed before switching off the free account.
Before step 1
Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.
- installfree
Why Every step below is a command you type or a file you edit.
Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗
Verify
You can open a folder and run a command in its terminal - installfree
Why History for your code, and the way most hosts deploy.
Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗
Verify
git --version prints a version - decidefree
Why The honest reason to do this is owning the control plane, not saving money.
Get it Read tailscale.com/pricing once. open ↗
- accountabout $5 a month
Why This needs one process running all the time with a public address. The coordination server needs a public IP.
Get it Hetzner Cloud (from about 4 EUR), DigitalOcean or Fly.io. Ubuntu 24.04, the smallest size. You need SSH access and a public IP. Only needed for the deploy phase; develop locally first. open ↗
- accountroughly $10 a year, or free on an existing domain
Why hs.yourdomain.com
Get it Register at Cloudflare Registrar, Porkbun or Namecheap, or use a subdomain of one you already own. You add one DNS record in the deploy phase. open ↗
- installfree
Why Automatic HTTPS in front of the Node process. Without TLS the browser features this relies on (and your visitors' trust) do not work.
Get it On the VPS: follow the install steps at caddyserver.com/docs/install for Ubuntu. One Caddyfile with your domain and a reverse_proxy line is the whole config. open ↗
Verify
caddy version prints a version on the server - installfree
Why The control server.
Get it Download the .deb from github.com/juanfont/headscale/releases and install it on the VPS. open ↗
Verify
headscale version prints - installfree
Why The endpoints.
Get it tailscale.com/download for each platform. open ↗
- accountcents
Why The headscale database is the network's identity.
Get it rclone to B2 or R2. open ↗
Environment variables
These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.
| Variable | Needed | Example | Where the value comes from |
|---|---|---|---|
HEADSCALE_URL | required | https://hs.yourdomain.com | Public server URL in config.yaml. |
BASE_DOMAIN | required | ts.yourdomain.internal | MagicDNS base domain; must differ from the server's domain. |
The build, in order
The server
headscale up behind Caddy with one user.
Files
/etc/headscale/config.yamlCaddyfile- terminal
sudo systemctl enable --now headscale headscale users create you
done when · tick each as it passesFirst two devices
A laptop and a phone reach each other directly.
- terminal
headscale preauthkeys create --user you --reusable --expiration 24h tailscale up --login-server https://hs.yourdomain.com --authkey <key>
done when · tick each as it passesDNS and ACLs
Relays and exit node
Hostile NATs still connect; one machine routes traffic.
- terminal
tailscale up --advertise-exit-node headscale routes enable -r <id>
done when · tick each as it passesBackup and restore drill
The database off the box and a restore that keeps devices connected.
- terminal
sqlite3 /var/lib/headscale/db.sqlite ".backup '/tmp/hs-$(date +%F).db'" rclone copy /tmp/hs-$(date +%F).db remote:headscale/
done when · tick each as it passeswatch out- Until the restore drill is done, keep the free Tailscale account.
Operateproduct builder
Updates, monitoring, key expiry handling.
done when · tick each as it passes
That is the whole plan for Tailscale. What it deliberately does not cover is below · check the gaps before you call it a replacement.
- SSO with every provider, the admin console, device posture: the seat price, and free for six people anyway.
- SSO with every identity provider, done
- the admin console and device posture
- Funnel and the relay network at their scale
- someone else on call for the control plane
- OIDC login via headscale's OIDC support
- Subnet routers for a home network
Need the files? The project pack on the verdict page hands your agent the whole brief · more security.