Headscale Multi-Tenant Isolation for Tailnet, ACL, Routes, and MagicDNS
Upstream headscale is built around a single-tailnet assumption: one control-plane process manages one shared IP pool, one global ACL policy document, one MagicDNS suffix, and one default relay map. That works well for a single team, but running a SaaS platform—or isolating multiple departments and customer environments on shared infrastructure—requires strict multi-tenant boundaries across every layer of the control plane.
This post walks through the six isolation pillars implemented to transform single-instance headscale into a true multi-tenant architecture, which directly powers Larktun's tenant model today.
Why Logical Multi-Tenancy Matters
Without native tenant isolation, hosting multiple organizations on Headscale forces operators to choose between two painful extremes:
- One Headscale process + database per customer: High operational overhead, duplicated certificates/ports, and wasted idle RAM across hundreds of tiny personal networks.
- Sharing one tailnet with complex ACL rules: Fragile human-maintained rules where one typo can leak peer discovery, DNS names, or subnet routes across unrelated users.
Adding first-class tenant isolation inside Headscale combines the operational efficiency of shared infrastructure with the security boundary of dedicated networks.
Six Layers of Tenant Isolation
To guarantee that no tenant can observe, route to, or interfere with another tenant, isolation must be enforced across six subsystems simultaneously:
1. Isolated Tailnet Address Spaces
- Every tenant receives its own independent tailnet IP allocation space rather than drawing from one global pool.
- Tenants can stay on the standard overlay range (
100.64.0.0/10) or define custom private CIDR ranges (such as192.168.6.0/24) when integrating with existing enterprise address plans. - A built-in
defaulttenant preserves backward compatibility for traditional single-tenant workflows.
2. Per-Tenant ACL Policies
- Each tenant owns an independent ACL document (
groups,tagOwners,hosts,acls,autoApprovers). - Policy parsing, compilation, validation, and distribution run strictly inside the tenant's boundary—cross-tenant object references are structurally impossible.
- Updating or misconfiguring one tenant's policy has zero effect on any other tenant.
3. Tenant-Scoped Subnet Routes and Exit Nodes
- Subnet router advertisements (e.g.,
192.168.1.0/24) and exit nodes are tracked and approved strictly per tenant. - Two different tenants can both advertise
192.168.1.0/24for their own office or home LANs with zero route conflicts.
4. Scoped MagicDNS Namespaces
-
MagicDNS generates tenant-isolated FQDNs using the pattern:
hostname.<tenant_key>.<dns.base_domain> -
The built-in
defaulttenant usesdefaultas its namespace segment, while every additional tenant receives its own<tenant_key>subdomain. Two tenants can both name a machinenasorprod-dbwithout colliding.
5. Tenant-Aware CLI Administration
- Administrative CLI commands accept an explicit tenant flag (such as
-t <tenant_key>) to list users, inspect nodes, issue pre-auth keys, or approve routes within a single tenant scope. - Operators can audit or debug one workspace cleanly without sifting through global node listings.
6. Flexible Relay (DERP) Isolation
- Individual and starter tenants can ride on shared platform DERP relays for zero-setup connectivity.
- Enterprise or compliance-sensitive tenants can attach dedicated or user-managed DERP relay servers per tenant, ensuring relayed traffic never leaves approved regions or infrastructure.
Multi-Tenant CLI Output Examples
The captures below show tenant-scoped user listings alongside global vs. per-tenant node views:



How This Powers Larktun
Larktun takes this multi-tenant Headscale engine and wraps it in a visual SaaS console, automated onboarding, per-tenant audit logs, custom Chinese/Unicode device aliases, and cross-platform clients (desktop, Linux/NAS/OpenWrt, Android, and NoVPN iOS/iPad apps). Even an individual free user gets their own isolated tenant out of the box—no self-hosted control server required.