Skip to main content

Larktun Blog

Larktun Blog for zero-trust networking, secure remote access, Headscale, mobile access, secure SSH, release notes, and implementation case studies.

Put the Larktun Network Inside an App Without VPN Permission

· 8 min read
Larktun Contributor

On mobile devices, private device networking almost always raises the same question: do we need system VPN permission?

Whether you use Larktun or Tailscale, if you want every app on the phone to access a private network, the usual answer is yes. A system-level VPN tunnel gives the client full capability: traffic can be routed through the private network, DNS and routes can be handled centrally, and apps can access internal services without being aware of the tunnel. But this also creates practical friction. Users must understand and approve a VPN profile, apps may need extra platform capabilities, and the tunnel can conflict with a company VPN, campus VPN, or other proxy tools that already occupy the system network entry point.

So is there another path: can we use private device networking without requesting system VPN permission?

Yes. The key is tsnet.

Secure SSH With Larktun Without Exposing Port 22

· 7 min read
Larktun Contributor

I recently provisioned a free Oracle Cloud server with 4 CPU cores and 24 GB of memory. For a development server, that is generous enough for test services, build jobs, database experiments, and the occasional production-support workload.

But as soon as I needed remote SSH access, the classic question appeared: should I expose port 22 to the public internet?

My answer is clear: no.

What Is Larktun?

· 9 min read
Larktun Contributor

Sometimes a product does not begin with a grand plan. It begins with a small, ordinary wish.

You are away from home, and suddenly you need to publish a program, restart a service, or check the quiet little computer sitting on your desk. You only have a tablet or a phone in your hand. Still, you hope you can reach that machine as naturally as opening your own door.

Larktun grew out of that wish.

Headscale Multi-Tenant Isolation for Tailnet, ACL, Routes, and MagicDNS

· 4 min read
Larktun Contributor

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.

Headscale SaaS Seamless User Switching Between Cluster Nodes

· 5 min read
Larktun Contributor

Once you operate a sharded Headscale SaaS cluster, horizontal scaling is only half the operational story. Sooner or later you will need to rebalance a hot shard, drain a node for maintenance, or move an enterprise tenant onto a dedicated shard—without forcing every user to log in again.

This guide documents a production-tested pattern for near-seamless tenant migration across Headscale shards: scoped database migration + hot-reloaded Traefik routing + surgical TCP disconnect + automatic client reconnection.

Headscale Cluster Architecture for Large-Scale Device Onboarding

· 5 min read
Larktun Contributor

Standard headscale is designed as a single-node control plane backed by SQLite or PostgreSQL. That architecture is simple to self-host, but when device counts grow into the thousands across many independent users, a single Headscale instance hits hard ceilings in concurrent long-lived map streams, database write contention, and full netmap recalculations.

This article outlines the architecture used to evolve headscale from a single monolith into a horizontally scalable cluster: cluster_id logical sharding, shared PostgreSQL storage, an Admission and Control Service (ACS), mandatory query isolation, and incremental netmap rebuilds.

Stress Testing Headscale at 200+ Concurrent Clients

· 5 min read
Larktun Contributor

Running a small self-hosted headscale instance for ten personal devices is effortless. Operating Headscale as a production multi-user control plane is a completely different workload: every node join, disconnect, route change, or key rotation triggers map-response updates across peers. Before scaling Headscale into a multi-tenant SaaS control plane, you need repeatable load tests that measure both steady-state overhead and reconnect storms.

This guide documents a reproducible stress-testing workflow for 200+ concurrent clients using containerized Tailscale nodes, automated churn injection, and randomized TCP/UDP traffic sampling.

Using MagicDNS and Extra Records in Headscale

· 4 min read
Larktun Contributor

Remembering dynamic tailnet IP addresses quickly becomes painful once your private network grows past a handful of servers, NAS appliances, and laptops. Enabling MagicDNS in headscale solves this by automatically publishing readable hostnames for every enrolled node, and pairing it with extra_records_path lets you map internal LAN services and 4via6 routes to stable DNS names.

This guide covers how to configure MagicDNS in Headscale, structure extra-records.json, apply updates cleanly without disrupting connected clients, and verify DNS resolution end to end.

Headscale Series: Packaging Source-Built Headscale as a Docker Image

· 2 min read
Larktun Contributor

The official Headscale image is usually around 80MB in docker images. In contrast, custom images built from a handwritten Dockerfile are often much larger and harder to keep consistent with upstream releases.

This guide shows a closer-to-official approach: use ko to package a source-built Headscale Go binary into a minimal container image without maintaining a Dockerfile.