Skip to content

Run a local DERP relay on the NixOS box - #191

Draft
samestep wants to merge 15 commits into
mainfrom
local-derp-relay
Draft

Run a local DERP relay on the NixOS box#191
samestep wants to merge 15 commits into
mainfrom
local-derp-relay

Conversation

@samestep

Copy link
Copy Markdown
Owner

No description provided.

samestep and others added 2 commits July 19, 2026 17:00
Every VM is on the tailnet but behind per-VM NAT, and both physical machines
are behind T-Mobile 5G CGNAT, so Tailscale can never connect them directly and
relays all VM-to-VM traffic through a cloud DERP — up over the slow 5G upload
and back, at ~1 MB/s. Run derper on the always-on NixOS machine so the relay
stays on the LAN: the VMs prefer it at home (lowest latency) and fall back to
the cloud DERPs when away. The host does not join the tailnet; derper only
forwards already-encrypted WireGuard packets, so it can't read the traffic or
reach the VMs.

Self-signed and pinned by SHA256 in the DERP map, so no domain or ACME cert is
needed. Also disable Wi-Fi power saving, which added ~60-110 ms to every LAN
round-trip — enough that Tailscale rated the local relay no faster than the
cloud one and refused to use it; off, the hop is ~5 ms and the local relay wins.

The relay's IP is pinned so its self-signed cert doesn't drift. The gateway
(Arcadyan TMO-G4AR) exposes no DHCP settings, so rather than a reservation the
box holds a static 192.168.12.10 on its Wi-Fi connection, below the gateway's
pool. README documents that plus the rest: reading the pin derper logs, adding
the DERP-map region to the tailnet policy, and verifying.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Wku9K54eBg5KJnXDfpvkQ
derper stores its own private key in the file named by -c, and defaults that
path (/var/lib/derper/derper.key) only when it runs as root. Under DynamicUser
it's unprivileged, so without -c it exits at once with "-c <config path> not
specified" and systemd's restart limiter latches. Point -c at the state
directory so it creates and reuses the key there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Wku9K54eBg5KJnXDfpvkQ
samestep and others added 13 commits July 24, 2026 10:03
Measured from both Linux VMs: the relay works, but they mostly aren't
using it. `derper`'s LAN-side STUN lets them discover LAN-local mapped
endpoints, the per-VM NATs hole-punch, and they hold a direct path
(192.168.12.130:39424 <-> 192.168.12.10:41641). So step 4's "should
report via DERP(home)" read a success as a failure.

Also: the NixOS box's LAN hop is ~1 ms, not ~5 ms (p50 1.0, p90 1.5),
while the macOS host shows the same Wi-Fi power-saving tail this config
turns off on NixOS (p50 ~4 ms, p90 33 ms, p99 74 ms) with no equivalent
knob available.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GNWf7bQzqqVN7GUSEtbDMG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant