Bookmarks

    Nothing saved yet. Use the bookmark on any article. Bookmarks are kept on this device only: they stay private and work without an account.

    Settings

    Appearance

    Reading mode

    Font size

    Content width

    Line spacing

    Keyboard shortcuts

    /
    Search
    j k
    Next / previous story
    ← →
    Previous / next section (columns)
    b
    Bookmarks
    s
    Settings
    r
    Columns / scroll
    t
    Light / dark

    Saved in this browser only.

    Ping2Prompt
    Subscribe to the Weekly Brief Sign in
    Dense bundles of blue network patch cables run down from rows of lit network switch ports in a dark server rack.
    Photo by Scott Rodgerson on Unsplash

    Tailscale DERP relays vs a self-run WireGuard tunnel: how each beats hard NAT

    Automated source check

    Tailscale WireGuard

    The problem they solve

    Both options exist for one stubborn case: a device you want to reach sits behind a firewall or hard NAT that blocks direct paths. Tailscale uses DERP servers to coordinate connections and as a last-resort relay. A self-run WireGuard tunnel instead relies on static peers, optional persistent keepalive and a relay that you run yourself.

    The two are closer than they look, because Tailscale's base layer is WireGuard, in the userspace Go form called wireguard-go. The real difference is who finds the path and who operates the box in the middle. One gap up front: our sources do not describe the full VPS reverse-tunnel layout, so we work from WireGuard's own docs for each part.

    How Tailscale does it

    DERP stands for Designated Encrypted Relay for Packets. These servers handle NAT traversal and connection negotiation between tailnet devices, and they act as a fallback when no direct path works. Most connections only use DERP to set up a direct link.

    Devices relay through DERP as a last resort, for example when hard NAT or a firewall blocks the direct path. Before DERP, Tailscale tries any peer relays you have set up, and those run on tailnet devices rather than DERP servers. DERP carries two kinds of packets: DISCO discovery messages and encrypted WireGuard packets.

    DISCO messages mostly flow before a direct connection exists between two devices. Each client gets a DERP map from the coordination server and picks a home DERP server by latency. It reports that choice to the coordination server, which shares it with the other clients in the tailnet.

    Tailscale runs DERP in many regions on several continents, and most regions have at least three servers. The servers are dual-stack, so they can join IPv4-only and IPv6-only devices.

    The text we reviewed does not give the STUN steps, and it does not say how the coordination server hands out public keys. It also does not say whether DERP relaying uses TCP or UDP.

    How WireGuard does it

    A WireGuard peer is defined by its public key, its allowed-ips and an endpoint. You generate keys yourself with wg genkey and wg pubkey. All packets travel over UDP, and the handshake is Noise_IK.

    In a hub-and-spoke layout, each node only needs to know the hub. The hub usually has a static IP address and an open firewall port, so it can accept connections even from nodes behind firewalls. By default WireGuard stays silent when idle and only sends when a peer has data.

    That is why a peer behind NAT can lose its mapping. Persistent keepalive fixes this by keeping the NAT or firewall mapping open, so the peer can still receive packets while idle. It is off by default, and the docs call 25 seconds a sensible interval for a wide range of firewalls.

    Separately, WireGuard repeats its handshake every few minutes to rotate session keys. The sources we have do not describe any relay or path discovery inside WireGuard itself, so the relay is whatever machine you run.

    What each one trusts

    On the Tailscale side, relayed traffic stays encrypted with WireGuard. Private keys never leave the device that made them, so a DERP server only forwards packets it cannot decrypt. The coordination server does hand clients the DERP map and shares each client's home DERP choice.

    The sources do not say what else it is trusted with, such as identity, access rules or key authentication. They also do not say what a compromised coordination server would mean for you. On the WireGuard side, you hold the keys and decide which peers exist.

    Tailscale notes that with a hub, each new user or server means distributing keys to the other side by hand. The protocol claims perfect forward secrecy, replay protection, resistance to key-compromise impersonation and identity hiding. It also supports an optional pre-shared key mixed into the public-key crypto.

    The primitives are ChaCha20-Poly1305, Curve25519, BLAKE2s, SipHash24 and HKDF. Because the hub is a machine you configure and own, it makes sense to treat it as a trusted, hardened box.

    Failure modes and cost

    A hub design sends all traffic through the hub, which can add latency when users or targets are far from it. In that design, nodes cannot talk to each other directly. If you try to avoid the hub with a full manual mesh, ten nodes need 90 tunnel endpoint configurations.

    Rotated keys must be updated on every node, and dynamic IPs and per-node firewall ports add more work. Keepalive has a small cost, since it makes WireGuard slightly more chatty. If a handshake fails, WireGuard gives up after REKEY_ATTEMPT_TIME and clears queued packets until a new packet is queued.

    On Tailscale, DERP-relayed paths can be too slow if they happen often. Tailscale then recommends peer relays over a custom DERP server. It says peer relays give lower latency, avoid cloud egress charges and avoid maintaining DERP servers.

    Running your own DERP server is advanced and resource-intensive, since you build, deploy and update the derper binary. Custom servers also lack device sharing and cross-tailnet features, and they miss some control plane optimizations. To see which DERP servers apply to a device, run tailscale netcheck.

    You can disable a region in the policy file by setting its RegionID to null. No source we have gives latency or throughput numbers, DERP rate limits, or behavior when DERP or the coordination server is down. Nothing documents what happens when your own VPS goes offline either.

    Which one, for whom

    If you manage many devices and do not want to handle keys and endpoints by hand, Tailscale is the lower-effort choice. If DERP relaying feels slow, set up peer relays before you consider building a custom DERP server. If you have one or two services and want to own every hop, a WireGuard tunnel through a host you control fits better.

    Set persistent keepalive on the peer behind NAT and plan to manage keys yourself. If you need hard numbers on latency or throughput, test both paths on your own links, since the sources give none.

    Sources

    Image: Photo by Scott Rodgerson on Unsplash


    This story was produced with AI assistance from the sources listed above and fact-checked against them before publication. Read our editorial methodology and the corrections log. Spotted an error? Email [email protected].

    Continue

    Share on Bluesky · Mastodon · Email ·

    Discussion