A managed mesh-VPN is good right up to the first "the provider blocked it" or "the coordination server is down". Experience of replacing a managed solution (ZeroTier) with self-hosted Headscale — why we left, how we built our own coordination, and how we migrated the network with zero downtime.

Why we left

  • Coordination in someone else's cloud. Their server being unreachable means your network being unreachable: your nodes are healthy, but there are no connections — and nothing you can do about it.
  • Hostile providers. Some providers and mobile carriers degrade mesh-protocol traffic; the fallback over a TCP relay isn't always stable.
  • No control over the relay. With Headscale you run your own relay next to the coordination — a direct replacement for "someone else's grey" relays, with your own stats and access.
  • Native clients on every OS. Linux, Windows, macOS, iOS, Android connect to a custom server with the stock client — no separate VPN app, no manual certificates.

Architecture: two parts of our own

ComponentRoleWhat matters to configure
Coordination server (Headscale)node registry, key and route distributiona domain with TLS, persistent storage in /var/lib/headscale
Relaybypassing symmetric NAT and blocksthe built-in relay enabled, on a public port
Clientsnetwork nodes: servers, laptops, mobile devicesconnect to your own coordination server, preauth keys

Installing the coordination server

The key part of the config (domains are examples):

server_url: https://hs.example.internal:443
listen_addr: 0.0.0.0:8080
metrics_listen_addr: 127.0.0.1:9090
prefixes:
  v4: 100.64.0.0/10
derp:
  server:
    enabled: true
    region_id: 999
    region_code: "self"
    region_name: "Own relay"
private_key_path: /var/lib/headscale/private.key
dns:
  nameservers:
    global:
      - 1.1.1.1

Then — users and connection keys:

headscale users create ops
headscale preauthkeys create -u ops --expiration 1h --reusable

# on the new node
tailscale up --login-server https://hs.example.internal

A node connects with a single key and no manual certificates; the node list and their online status are visible on the coordination server.

Batch migration

  1. Parallel install. The new network comes up next to the old one: nodes temporarily live in both, connections don't break.
  2. First batch — idle servers. We verify: connectivity, throughput between nodes, behavior on restart.
  3. Second batch — working nodes. Migrated in batches of three to five nodes, with a verification pause between batches.
  4. Mobile devices and laptops — last. Where providers interfere the most, the new relay gets tested "in the field".
  5. Only after the full migration is the old network shut down — not earlier: running both in parallel is cheap, rolling back is expensive.

Removing the old solution — as a separate script

Leftovers of the old network in the system are worse than a short downtime: phantom interfaces and routing rules resurface for months. The full removal scenario:

  1. Stop the service and disable autostart.
  2. Remove the package with the package manager.
  3. Clean configs and state (/var/lib, system directories).
  4. Delete the interface and routes the network managed to create.
  5. Review firewall rules: open what was closed for the old network, and vice versa.
  6. Delete the key repository and old configs on all nodes, per a checklist.

The old deploy script isn't deleted but archived: the history of decisions is worth more than repository space.

Operations

  • State backups. /var/lib/headscale is the whole network (nodes, keys, users): backed up on a schedule, alongside the rest of the infrastructure.
  • Monitoring. Metrics on metrics_listen_addr: node count, online status, registration errors — into the shared Prometheus; an alert on a drop in online nodes.
  • Server upgrades — snapshot the state beforehand; clients survive a coordination restart, connections don't break.
  • The repository README fixes the status: what's migrated, what remains, how to connect a new node. One document instead of oral history.

The result: coordination and relay are ours, the dependency on someone else's cloud is zero, adding a new node is one command, and a provider blocking the protocol is solved by our own relay on our own site.

The rule for any mesh network: coordination is your single point of failure, and it must live with you. A managed service is a good start, but not the final destination of a mature infrastructure.

ACLs: who can reach whom

By default everyone in a mesh network sees everyone — too wide for a working network. Headscale (like Tailscale) describes access declaratively:

acls:
  - action: accept
    src: ["group:ops"]
    dst: ["tag:server:*"]
  - action: accept
    src: ["group:dev"]
    dst: ["tag:dev-sandbox:*"]
  # principle: groups of people → node tags; hostnames (host:) only for point exceptions
  • Tags instead of users: nodes get tagged at registration (headscale nodes tag set), access is described against tags — a node changed owners, the tags stayed.
  • Groups via IdP-Headscale (OIDC sync): access follows directory group membership — offboarding happens automatically.
  • ACL changes go through review: every edit is an MR in the repository with the Headscale config; "temporary" work without review is the standard source of "temporary holes" that live forever.

Mesh network monitoring: the minimal set

MetricSourceAlert
Online node countheadscale metrics> 30% of nodes dropped at once
Registrations/errorsheadscale metricsgrowing errors = coordination problems
Latency between node pairstailscale ping via cron → push metricdirect tunnel degradation
Coordination server certificateblackbox/cert-exporter14 days before expiry

The last row is the most underrated: an expired coordination certificate looks like "the network died", but it's fixed by a renew. Same for backing up /var/lib/headscale: losing that directory means re-registering every node.