Here is the inconvenient truth behind mesh VPN marketing: when two devices sit behind strict symmetric NAT firewalls, direct peer-to-peer UDP hole punching is mathematically impossible without external coordination or probabilistic guessing.
Vendors love to promise seamless point-to-point WireGuard mesh connectivity across home labs, remote branches, and cloud VPCs. But enterprise firewalls and carrier-grade NAT (CGNAT) routers do not cooperate with idealistic network diagrams. When Tailscale and NetBird promise zero-configuration meshes, they are not breaking the laws of networking. They are running a deeply orchestrated sequence of discovery, local router negotiation, asymmetric port mapping tricks, and zero-knowledge fallback relays.
At 365Finds, we look at mesh networking tools through the lens of infrastructure independence. Distributed teams and self-hosters want direct low-latency tunnels, not perpetual bandwidth dependence on someone else's cloud relay. Understanding how Tailscale's DISCO/DERP stack and NetBird's Pion ICE engine actually handle restrictive symmetric firewalls separates real engineering from marketing mythology.
The Anatomy of the Wall: Why Symmetric NAT Breaks Hole Punching
To appreciate the workarounds, you have to understand why symmetric NAT exists and why standard UDP hole punching fails against it.
In standard consumer routers operating under Endpoint-Independent Mapping (often termed Full Cone or Restricted Cone NAT), an internal client sending traffic from local port 51820 gets assigned a public socket—say, 203.0.113.10:41000. Crucially, that mapping remains stable. If the client sends a packet to a STUN server to discover its public endpoint, and then sends another packet to a remote peer, the router reuses 203.0.113.10:41000. Both endpoints can query STUN, trade their public sockets through a coordination server, fire simultaneous UDP packets at each other, and punch matching state entries into their respective firewalls.
Symmetric NAT destroys this predictability.
Under Endpoint-Dependent Mapping (Symmetric NAT), the firewall creates a brand-new external port allocation for every distinct destination IP and port tuple:
- Device A sends an outbound UDP probe to Tailscale or NetBird's STUN server at
198.51.100.1:3478. The firewall maps internal port51820to external port42001. - The STUN server inspects the packet header and reports back: "Your public endpoint is
203.0.113.10:42001." - Device A passes this address to Device B via the central signaling plane.
- Device B transmits UDP packets directly toward
203.0.113.10:42001. - Device A attempts to transmit UDP packets directly to Device B's public IP. But because Device B has a different IP and port than the STUN server, Device A's symmetric router instantly assigns an entirely new external port—say,
47892. - Device B's incoming packets hit port
42001on Device A's router. The firewall inspects its state table, sees that42001was only authorized for the STUN server's IP, and silently drops the packet.
If both endpoints sit behind symmetric NATs, neither knows what external port the other's router will generate for the peer-to-peer session. Direct communication stalls before the first WireGuard handshake can complete.
Direct Traversal Tactics Before Giving Up on P2P
Before falling back to relays, both Tailscale and NetBird run through an aggressive ladder of local traversal protocols to puncture the firewall or bypass the NAT entirely.
+---------------------------------------------------------------+
| Connection Flow Hierarchy |
+---------------------------------------------------------------+
|
[1] Same LAN / Subnet?
/ \
Yes / \ No
v v
Direct Local IP [2] Native IPv6 Available?
/ \
Yes / \ No
v v
Direct IPv6 Tunnel [3] Port Mapping Protocols
(UPnP / NAT-PMP / PCP)
/ \
Yes / \ No
v v
Port Forwarded [4] Asymmetric NAT Punch
Direct P2P (One Cone, One Symmetric)
/ \
Yes / \ No
v v
Direct UDP Tunnel [5] Encrypted Relay
(DERP / TURN Coturn)
1. LAN and Subnet Reflection
If both nodes share a physical network or a flat corporate subnet, traversing the public NAT is an unnecessary detour. Both clients discover local interface IPs. NetBird collects host candidates via ICE; Tailscale transmits local discovery beacons. If an internal route responds, the tunnel binds directly to the private LAN address.
2. Dual-Stack IPv6 End-to-End
The cleanest solution to IPv4 symmetric NAT is not dealing with IPv4 at all. If both corporate offices or homelabs have globally routable IPv6 allocations, NAT is nonexistent. Tailscale and NetBird automatically detect IPv6 availability. If stateful firewalls allow outbound UDP traffic on IPv6, outgoing packets carve out return state paths, establishing direct point-to-point WireGuard tunnels without address translation.
3. Port Mapping Protocols (UPnP, NAT-PMP, and PCP)
Many enterprise and prosumer routers run port mapping protocols that clients can query programmatically:
- UPnP (Universal Plug and Play): Common on branch office and consumer routers.
- NAT-PMP (NAT Port Mapping Protocol): Apple's predecessor to PCP.
- PCP (Port Control Protocol): RFC 6887, modern successor capable of handling carrier-grade NAT mapping requests.
Tailscale and NetBird actively probe local default gateways for these protocols. If enabled, the client explicitly asks the router: "Map external port 51820 directly to my local port 51820." If the router accepts, Endpoint-Dependent port translation is overridden, turning a hard symmetric firewall into an open, directly addressable listener.
4. Asymmetric NAT Punching (Symmetric vs. Cone)
A pure symmetric-to-symmetric lock occurs less frequently than an asymmetric pairing—where Node A sits behind a symmetric firewall, but Node B is on an Endpoint-Independent (Cone) NAT or has an exposed port.
In this scenario, direct P2P is entirely achievable:
- Node B (Cone NAT) queries STUN and receives a stable public socket:
198.51.100.25:35000. - Node A (Symmetric NAT) receives Node B's socket from the coordination server and immediately sends an outbound UDP probe directly to
198.51.100.25:35000. - Node A's router assigns a randomized port (e.g.,
58412), but it creates an outbound state entry permitting replies from198.51.100.25:35000. - When Node A's packet hits Node B, Node B notes the source IP and source port (
58412). - Node B switches its transmission target to
58412. Because Node A just sent a packet to Node B, Node A's symmetric firewall accepts the incoming stream. Direct P2P tunnel established.
The Myth of the Birthday Paradox Port Guess
In theoretical networking literature, engineers frequently bring up the "Birthday Attack" for symmetric-to-symmetric NAT traversal.
If Node A and Node B both sit behind symmetric NATs that allocate ports randomly across the 16-bit port space (1 to 65,535), neither side knows where to send packets. But based on the mathematics of the birthday problem, if Node A sends several hundred packets to random ports on Node B's IP, and Node B does the same to Node A's IP, the probability of an overlapping open state collision increases rapidly.
Tailscale explored this exhaustively in their research. But 365Finds strongly cautions against treating this as a viable production architecture:
- It requires generating massive bursts of hundreds or thousands of blind UDP packets across a wide port range.
- Modern enterprise intrusion prevention systems (IPS) and stateful firewalls classify wide-range UDP bursts as port scans or denial-of-service attempts, immediately blacklisting the client IP.
- Many symmetric NAT implementations do not allocate ports in a uniform random distribution; they employ randomized step offsets or completely dynamic connection trackers that drop unsolicited incoming traffic even if port numbers collide.
Because probabilistic guessing is noisy, brittle, and battery-draining, neither modern Tailscale nor NetBird relies on birthday attacks in production. When clean direct hole punching fails, they route.
Relay Architectures: DERP vs. TURN/ICE
When two symmetric firewalls refuse to yield, traffic must traverse an intermediate node. But how these tools relay traffic—and who controls those relays—is where Tailscale and NetBird diverge in design philosophy.
Tailscale's DERP (Designated Encrypted Relay for Packets)
Tailscale built a custom application-layer relay protocol known as DERP.
- Transport Mechanism: DERP runs over HTTP/2 and WebSockets encapsulated in TLS on TCP port 443.
- Firewall Evasion: Strict corporate proxies and deep packet inspection firewalls routinely block arbitrary high-number UDP ports. Because DERP looks identical to standard outbound HTTPS browsing traffic, almost no corporate firewall blocks it.
- Continuous Probing: Tailscale does not treat DERP as a permanent dead end. While peers exchange WireGuard traffic over DERP, the client daemon periodically sends out DISCO (Discovery) UDP probes in the background. If network conditions shift—for example, if a port mapping becomes active or a laptop switches Wi-Fi networks—Tailscale dynamically upgrades the connection from DERP to direct P2P without dropping the active session.
NetBird's Pion ICE and Coturn Engine
NetBird relies on standard WebRTC primitives, built on top of Pion ICE:
- Candidate Gathering: NetBird peers collect
host(local IP),srflx(STUN-discovered public IP), andrelay(TURN-allocated IP) candidates. - TURN Relay Fallback: If STUN checks fail to punch through symmetric boundaries, NetBird routes traffic through TURN relays. Historically, this meant deploying Coturn; modern NetBird distributions integrate an embedded Go relay service directly into the management stack.
- Protocol Flexibility: NetBird can relay over UDP TURN, TCP TURN, or TLS-encrypted TURN, selecting the lowest-latency path that clears the firewall's egress filtering rules.
Zero-Knowledge Isolation: Why Third Parties Cannot Read Your Data
The user's core concern is whether traffic relayed through intermediate servers compromises security.
At 365Finds, we emphasize a fundamental cryptographic reality: relaying is not decrypting.
Both Tailscale and NetBird are control planes managing WireGuard tunnels. WireGuard establishes cryptographic keys directly between the two communicating endpoints:
- Node A encrypts the network payload using Node B's public key (via ChaCha20-Poly1305).
- The encrypted WireGuard packet is wrapped inside an outer transport envelope (a DERP frame or a TURN packet).
- The relay server reads only the destination client ID or socket header to forward the byte stream.
- Node B receives the packet, strips the transport wrapper, and decrypts the payload using its private key.
The relay server—even when operated by Tailscale Inc. or a public Coturn host—possesses no private keys and cannot inspect, manipulate, or inject traffic into the tunnel. The only metadata exposed to the relay is packet timing, overall bandwidth volume, and public IP endpoints.
Eliminating Third Parties: Self-Hosting Your Coordination and Relays
If corporate policy or zero-trust compliance mandates that no packets—not even end-to-end encrypted payloads—touch third-party servers, both ecosystems allow complete infrastructure self-hosting.
| Architectural Component | Tailscale (Open Source Alternative) | NetBird (Native Open Source) |
|---|---|---|
| Control / Signaling Plane | Headscale (Community Go implementation) | NetBird Management & Signal Services |
| Relay Infrastructure | Custom DERP server (tailscaled --derp) | NetBird Embedded Relay / Coturn |
| P2P Framework | Tailscale DISCO + WireGuard-go | Pion ICE (WebRTC) + Kernel/Userspace WireGuard |
| Authentication Backend | OIDC (Keycloak, Authentik, Okta) | OIDC (Keycloak, Authentik, Zitadel) |
| Default Relay Protocol | HTTPS / TLS WebSockets (Port 443) | STUN / TURN (UDP & TCP, optional TLS) |
Deploying a Custom DERP Node on Tailscale / Headscale
You can deploy your own DERP server on an unfirewalled VPS with a static IP and point your clients to it via your Headscale or Tailscale ACL configuration:
{
"derpMap": {
"Regions": {
"900": {
"RegionID": 900,
"RegionCode": "custom-vps",
"RegionName": "Private Office Relay",
"Nodes": [
{
"Name": "derp-node-1",
"RegionID": 900,
"HostName": "derp.example.com",
"DERPPort": 443,
"STUNPort": 3478
}
]
}
}
}
}
Setting "OmitDefaultRegions": true prevents clients from ever falling back to Tailscale's global relay network, ensuring 100% of relayed traffic flows exclusively across your own hardware.
Deploying Private Relays in NetBird
NetBird's self-hosted architecture combines the Management service, Signal service, and Relay into a single Docker Compose stack. In docker-compose.yml, configure the embedded relay or an external Coturn instance:
services:
netbird-relay:
image: netbirdio/netbird-relay:latest
environment:
- NB_LISTEN_ADDRESS=:33080
- NB_EXPOSED_ADDRESS=relay.example.com:33080
- NB_AUTH_SECRET=your-secure-shared-secret
ports:
- "33080:33080"
Peers negotiate signaling through your private Signal server, attempt STUN hole punching, and fall back strictly to your internal relay.example.com container when symmetric firewalls block direct paths.
Summary Checklist for Network Engineers
To maximize direct peer-to-peer connections and avoid relay fallback across strict firewalls:
- Enable IPv6 across all branch offices and cloud VPCs; native IPv6 eliminates IPv4 symmetric NAT traversal issues entirely.
- Ensure stateful firewalls allow outbound UDP traffic on high ports, or permit UPnP/PCP on edge routers where security policy allows.
- If symmetric NAT cannot be avoided on one end, ensure the opposing peer has an Endpoint-Independent (Cone) NAT or an exposed public port.
- When traversing pure symmetric-to-symmetric networks, self-host a private DERP or NetBird Relay server on an edge VPS to guarantee low-latency, end-to-end encrypted relaying without third-party exposure.
The WireGuard handshake either reaches its destination directly or through an encrypted hop. In both cases, the cryptographic boundary stays firmly on your machines.
References
- How NAT Traversal Works - Tailscale Blog
- How Tailscale Works - Architecture Overview
- NetBird Architecture Documentation
- NetBird Self-Hosted Guide
- RFC 8445: Interactive Connectivity Establishment (ICE)
- RFC 5389: Session Traversal Utilities for NAT (STUN)
- RFC 8656: Traversal Using Relays around NAT (TURN)