Back to Blog
VPN 4 min readLast updated

Tailscale on a Zero-Trust Network — Why I Kept Relay and Removed the Port Forward

Tailscale on the Pi with subnet routing. Direct connections via port forward offer speed but violate zero-trust posture. Relay accepts higher latency for security alignment.

Update, October 2026: Tailscale is gone from this network. Remote access is now the WireGuard Admin VPN only — one path in, terminated on the gateway. The reasoning below about refusing the port forward and UPnP still holds. The Tailscale-specific details are kept for reference.

Tailscale is installed on the internal Pi on the MGMT VLAN with a subnet route advertising the MGMT network to the Tailscale network. All Tailscale nodes have key expiry disabled — once they join, they stay joined. Tailscale overrides the system nameserver so that DNS queries from Tailscale clients reach the Pi's Technitium instance.

This gives remote access to the MGMT VLAN — SSH to the Pi, DNS queries via the Pi's resolver, monitoring dashboards — from anywhere on the Tailscale network.

The Port Forward Recommendation#

Tailscale's documentation recommends port-forwarding UDP 41641 (Tailscale's DERP heartbeat and NAT traversal port) to the Tailscale node for direct peer-to-peer connections. With the port open, Tailscale can establish direct connections between peers instead of falling back to encrypted relay.

Direct connections are faster. NAT traversal works better. Latency is lower.

But this is a zero-trust network. Deliberately opening a UDP port on the WAN for convenience undermines the entire security posture. All inbound access to this network is either through WireGuard (authenticated, explicit, with peer IP and certificate validation) or rpi-connect (outbound-initiated, no inbound listening, no exposure). Adding a UDP pinhole for Tailscale convenience violates the same principle. It trades the controlled access model for the sake of latency.

The port forward was removed.

UPnP: Also Rejected#

UPnP is a mechanism that allows any device on a LAN to request that the gateway open ports on the firewall dynamically. The theory is convenience — a game console on your home network can request that UDP 27015 (CS:GO) be forwarded without the admin's involvement.

On a zero-trust network with DEFAULT DROP policies, UPnP is fundamentally incompatible. It allows any LAN device to punch holes in the firewall without administrator action. A compromised device can request any port be forwarded to it. A misconfigured IoT camera can open access to itself without anyone knowing. UPnP is disabled entirely on this network.

Relay Accepted: The Security Tradeoff#

With port forwarding disabled and UPnP rejected, Tailscale falls back to DERP relay. DERP (Designated Encrypted Relay for Packets) is Tailscale's fallback encrypted relay infrastructure. When direct connections aren't available, Tailscale routes traffic through Tailscale-operated relay servers. The traffic is encrypted end-to-end — Tailscale never sees the plaintext — but it is relayed through a third party.

For a zero-trust network, this is the correct tradeoff. Latency is slightly higher — maybe 5-10ms additional round-trip time — but the security posture is aligned. No listening ports on the WAN. No UPnP. No firewall holes for convenience.

For the use cases (SSH to the Pi, DNS queries, monitoring dashboards), the additional latency is imperceptible. The device is a management tool, not a gaming console.

CGNAT Range in Firewall Allowlists#

Tailscale uses the CGNAT range 100.64.0.0/10 for node addresses on the Tailscale network. Any firewall rules that match Tailscale traffic need to include this range.

In Technitium DNS, the CGNAT range is in the QPM (Query Per Minute) bypass list. Otherwise Tailscale's internal DNS queries from Tailscale nodes get rate-limited and fail. In any firewall allowlist where Tailscale traffic needs to be permitted (like the Trusted VLAN reaching Tailscale clients), the CGNAT range is included.

JSON Status Parsing: PrimaryRoutes Field#

When scripting against tailscale status --json, use PrimaryRoutes to check advertised routes on the self object. The field AdvertisedRoutes does not exist on the self object — using it returns null and scripts silently fail.

Correct:

tailscale status --json | jq '.Self.PrimaryRoutes'

Incorrect (silently fails):

tailscale status --json | jq '.Self.AdvertisedRoutes'

Always check the JSON schema by running tailscale status --json | jq . | less and reading the actual fields before writing a query.