VPN Protocols Compared: WireGuard, OpenVPN, IKEv2, REALITY and Hysteria2
How WireGuard, OpenVPN, IKEv2/IPsec, SSTP, L2TP and PPTP work on the wire, how each is detected by DPI and active probing, and when Shadowsocks, Trojan, VLESS+REALITY, Hysteria2 or obfs4 is the better pick.
A VPN protocol decides three things about a tunnel: how fast it moves packets, how it breaks, and whether the network in between can tell what it is. The first two matter on every network. The third decides whether the tunnel works at all in a hotel that only allows port 443, on a corporate egress firewall, or behind a national censor that runs deep packet inspection and sends its own probes to suspected servers.
This guide is the protocol-level companion to What Is a VPN and How It Actually Works, which covers what a tunnel protects, DNS and WebRTC leaks, kill switches and provider trust. Here the subject is the wire: what each protocol sends, how an observer recognises it, and how it fails. The VPN protocol comparison tool puts 21 tunnels side by side if you want to filter by port or roaming support while you read.
Two kinds of detection
Every protocol below gets judged on two separate questions.
Passive detection is what a DPI box on the path can infer from packets it watches: port numbers, fixed header bytes, message sizes, the timing and direction of the first few packets, and statistical properties such as entropy. It costs the observer almost nothing per flow.
Active probing is what a censor learns by connecting to a suspected server itself. It sends a handshake, a replayed packet, or random bytes, and watches whether the server answers, resets, or waits. A protocol that only answers clients who prove they hold a secret is resistant to probing. One that answers anyone who speaks the protocol confirms itself to every scanner.
A protocol can be strong on one axis and weak on the other. WireGuard is the clearest example.
WireGuard
How it works
WireGuard runs one handshake pattern from the Noise framework, named in full as Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s. The IK means the initiator already knows the responder's static public key and transmits its own static key encrypted. psk2 mixes in an optional pre-shared key, 25519 is Curve25519 for Diffie-Hellman, ChaCha20-Poly1305 is the AEAD, and BLAKE2s is the hash. There is no cipher negotiation. A future change of primitives would be a new protocol version.
The handshake is one round trip: a 148-byte initiation and a 92-byte response, after which both sides hold symmetric session keys derived from ephemeral and static Diffie-Hellman results. The ephemeral keys are why compromising a long-term key does not decrypt recorded sessions; Perfect Forward Secrecy Explained walks through that property and How Diffie-Hellman Works covers the exchange underneath it.
Session keys rotate on fixed timers from the whitepaper. The initiator starts a new handshake when its key is 120 seconds old (Rekey-After-Time), and any key older than 180 seconds is rejected (Reject-After-Time). A failed handshake is retried every 5 seconds, with jitter, for up to 90 seconds.
Cryptokey routing replaces the usual mix of routes and firewall rules. Each peer is a public key with a list of AllowedIPs. When the interface sends a packet, WireGuard looks up the destination address in all peers' AllowedIPs and encrypts to the matching peer. When a packet arrives and decrypts under a peer's key, WireGuard checks that its inner source address falls inside that same peer's AllowedIPs, and drops it otherwise. The one list is a routing table outbound and an access-control list inbound.
Data packets carry a 16-byte header (a 1-byte message type, 3 reserved zero bytes, a 4-byte receiver index and an 8-byte counter) and a 16-byte Poly1305 tag. Add an 8-byte UDP header and a 20-byte IPv4 or 40-byte IPv6 outer header and the overhead is 60 or 80 bytes per packet. wg-quick assumes the worse case and sets the interface MTU to the outgoing link's MTU minus 80, which is 1420 on a standard 1500-byte Ethernet path.
Speed
WireGuard has been in the mainline Linux kernel since 5.6 and runs in-kernel on the BSDs and as a kernel driver on Windows. Packets never cross into userspace, and ChaCha20-Poly1305 is fast on CPUs without AES instructions, which covers most routers and older phones. On commodity hardware it saturates gigabit links with modest CPU use.
Detectability
Passive: easy. The first byte of every packet is a message type of 1, 2, 3 or 4, followed by three zero bytes, and the handshake messages are always 148 and 92 bytes. A one-line DPI rule matches it. The default port 51820 adds a second clue, though changing the port removes only that one.
Active probing: resistant. Every handshake message carries a mac1 field computed with a key derived from the receiver's static public key, and the server rejects any message whose mac1 does not verify. A scanner that does not already know the server's public key cannot produce a valid mac1, and gets no response at all. Under load, the server may answer a valid mac1 with a cookie reply instead of doing the Diffie-Hellman work, which limits CPU exhaustion from a flood.
Forks such as AmneziaWG add junk packets and randomise the header fields to break the passive signature. They are incompatible with stock WireGuard peers.
Failure modes
- UDP blocked. WireGuard has no TCP mode. On networks that allow only TCP 80 and 443, it does not connect.
- MTU black holes. The handshake and pings pass, while full-size TCP segments vanish. Covered in the config mistakes section below.
- Silent failure. Because the server never answers a bad handshake, a wrong public key, a wrong endpoint and a blocked port all look identical from the client: no
latest handshakeinwg show. - Endpoint DNS resolved once. A hostname in
Endpointis resolved when the interface comes up. If the server's IP changes, the client keeps sending to the old address until restarted, or until a script such asreresolve-dns.shfrom wireguard-tools runs.
When to pick it
New site-to-site links, remote access you control both ends of, homelabs, and any commercial VPN client on a network that does not interfere with UDP. Generate a starting config with the WireGuard config generator, which creates the keys in your browser.
OpenVPN
How it works
OpenVPN runs two channels over one socket. The control channel carries a full TLS session (certificates, key exchange) over OpenVPN's own reliability layer, because it usually runs over UDP. The data channel carries tunnelled packets encrypted with keys exported from that TLS session. Since 2.5, peers negotiate the data cipher from data-ciphers, and the 2.6 default list is AES-256-GCM, AES-128-GCM and CHACHA20-POLY1305. The TLS mechanics are the same as in How the TLS Handshake Works.
It runs over UDP (default port 1194) or TCP. TCP mode exists to cross firewalls that block UDP and to sit on port 443, and it carries a known cost: when the outer TCP connection loses a packet it retransmits, and so does any TCP connection inside the tunnel. Both sets of timers back off at once, and throughput on a lossy link falls apart. This is usually called TCP meltdown.
Three options wrap the control channel in a pre-shared key:
| Option | What it does |
|---|---|
tls-auth | Adds an HMAC to every control packet. Packets without a valid HMAC are dropped before any TLS processing. |
tls-crypt | Encrypts and authenticates every control packet with a group key. Hides the certificates, makes the traffic harder to identify, and drops unauthenticated packets. |
tls-crypt-v2 | Same as tls-crypt with a separate key per client, wrapped by a server key, so one leaked client config does not expose the others. |
The manual also notes that tls-crypt gives a "poor man's" post-quantum layer against an attacker who never learns the pre-shared key.
Speed
Classic OpenVPN copies every packet between the kernel's tun device and a single-threaded userspace process, and that was the main reason it trailed WireGuard. OpenVPN 2.6 added Data Channel Offload (DCO): the ovpn-dco kernel module encrypts and forwards data packets in the kernel while userspace keeps only the control channel. The module was merged into mainline Linux as ovpn in 6.16, and a DCO driver exists for Windows.
DCO has limits by design. It supports only layer 3 (dev tun), only the AEAD ciphers AES-GCM and ChaCha20-Poly1305, no compression, and only topology subnet on servers. If a config contains an incompatible option, OpenVPN disables DCO with a log line and falls back to the slow path, so search the log for data channel offload (the wording and case vary by cause) after an upgrade.
Detectability
Passive: moderate to easy. Even with tls-crypt, every OpenVPN packet begins with a plaintext opcode and key ID byte, and the session opens with a recognisable sequence of reset and acknowledgement packets of characteristic sizes. A USENIX Security 2022 study built three fingerprints from byte patterns, packet sizes and server responses, deployed them at an ISP, and identified over 85% of OpenVPN flows with negligible false positives. It also identified 34 of 41 commercial "obfuscated" VPN configurations, many of which wrapped OpenVPN in XOR-style layers.
Active probing: depends on tls-auth or tls-crypt. A plain OpenVPN server answers a valid reset packet from anyone, which confirms it to scanners. With tls-auth or tls-crypt it drops anything without the shared key and stays silent. The study above still found server-response fingerprints in how servers time out or close connections.
Failure modes
- TCP meltdown on lossy links in TCP mode.
- Cipher and option mismatches between old clients and new servers. BF-CBC is no longer accepted by default, and pre-2.4 clients cannot use DCO.
- Compression enabled. Compression in a VPN reopens VORACLE-style attacks that leak secrets by compressed size, and it disables DCO. Use
compress migrateto move clients off it. - Certificate expiry. A PKI-based protocol fails on the day a CA or server cert expires, which surprises teams who set them up once years ago.
When to pick it
Existing deployments with a working PKI, networks where only TCP 443 gets out and SSTP is not an option, and environments that need its mature feature set (pushed routes, per-client config directories, plugin authentication). Paste a config into the VPN config auditor to see which settings would turn DCO off or weaken the control channel.
IKEv2/IPsec
How it works
IKEv2 (RFC 7296) negotiates keys; ESP carries the data. The negotiation is two request-response pairs. IKE_SA_INIT exchanges cipher proposals, Diffie-Hellman values and nonces in the clear. IKE_AUTH runs inside the keys from that first exchange, proves identity with certificates, a pre-shared key or EAP, and creates the first Child SA that ESP uses. Further Child SAs and rekeys use CREATE_CHILD_SA, and a fresh Diffie-Hellman there gives forward secrecy for each rekey.
IKE uses UDP 500. When a NAT is detected, both IKE and ESP move to UDP 4500, with ESP wrapped in UDP per RFC 3948. Without NAT, ESP travels as IP protocol 50, which many home routers and hotel networks mishandle. MOBIKE (RFC 4555) lets an established session change its IP address, which is why IKEv2 survives a phone moving from Wi-Fi to cellular.
Speed
ESP is processed in the kernel on every major OS, and AES-GCM with hardware AES instructions is fast. In practice IKEv2/IPsec performs in the same range as WireGuard, with more variance from implementation and proposal choice.
Detectability
Passive: trivial. Fixed ports 500 and 4500 and a cleartext IKE header with SPIs and an exchange type identify it on the first packet.
Active probing: answers. A responder replies to any well-formed IKE_SA_INIT with its own proposal, before any authentication. Tools such as ike-scan use this to fingerprint gateways and vendors at scale.
Failure modes
- UDP 500/4500 blocked, which is common on guest networks.
- Fragmentation of IKE_AUTH. Certificate chains can push IKE_AUTH past the path MTU, and a dropped fragment kills the handshake. RFC 7383 IKEv2 fragmentation fixes it where both ends support it.
- Proposal mismatch. Two vendors with no overlapping cipher suite fail with
NO_PROPOSAL_CHOSEN. Weak defaults such as MODP-1024 groups linger in old configs. - Edge appliance vulnerabilities. Many IPsec deployments terminate on firewall appliances with long records of exploited vulnerabilities, so patching the gateway matters as much as its configuration.
When to pick it
Managed fleets that need a native client without installing anything (iOS, macOS, Windows and Android 11 and later all ship one), site-to-site links with network vendors that speak IPsec and nothing else, and mobile users who switch networks constantly.
L2TP/IPsec and PPTP: legacy
PPTP runs a control connection on TCP 1723 and tunnels PPP inside GRE (IP protocol 47), with MPPE (RC4) encryption keyed from MS-CHAPv2 authentication. In 2012 Moxie Marlinspike and David Hulton showed that an MS-CHAPv2 exchange reduces to a single DES key search of 2^56, and Microsoft published Security Advisory 2743314 recommending against unencapsulated MS-CHAPv2. A captured PPTP handshake can be cracked and the session decrypted. Apple removed PPTP from iOS 10 and macOS Sierra in 2016. Treat it as plaintext.
L2TP has no encryption of its own and depends on IPsec underneath. Most deployments use IKEv1 with a group pre-shared key and user passwords inside. Commercial providers that published one PSK for all customers gave every customer what they needed to impersonate the server to any other customer. It also double-encapsulates (L2TP in UDP 1701 inside ESP inside UDP 4500), which costs MTU and passes poorly through NAT.
Microsoft announced in October 2024 that PPTP and L2TP are deprecated for inbound connections to Routing and Remote Access in future Windows Server versions, recommending SSTP and IKEv2 instead. Outbound client connections remain available. Migrate any server still accepting either.
SSTP
SSTP is Microsoft's PPP-over-HTTPS. The client opens a TLS connection to TCP 443, sends an HTTP request with the method SSTP_DUPLEX_POST to the path /sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/, and then runs PPP inside the TLS stream.
It gets through firewalls that allow only HTTPS, and it is native on Windows. It shares OpenVPN TCP's meltdown problem, since every tunnelled TCP stream rides on one outer TCP connection. On the wire the TLS handshake looks like any Windows TLS client, so passive DPI has little to work with, but an active prober that sends that fixed request to a suspected server gets an SSTP response and has its answer. Pick it for Windows clients on restrictive corporate or hotel networks with no censor in the picture.
Censorship-resistant transports
The protocols above were designed to protect content from eavesdroppers. The ones below are built to be mistaken for something else, or to look like nothing, by an adversary who will block whatever it can identify. Most of them are proxies (they forward TCP and UDP streams through SOCKS or a TUN wrapper such as sing-box or Xray's tun mode) rather than layer 3 VPNs, which is enough for nearly every use.
Shadowsocks
Shadowsocks encrypts a SOCKS-like stream with a pre-shared key so that every byte, including the first, looks random. It has no handshake and no fixed header. That made it hard to block for years.
The GFW now uses randomness itself as the signal. The IMC 2020 paper How China Detects and Blocks Shadowsocks showed a two-stage process: passive flagging on the length and entropy of the first data packet, then active probes to the flagged server, including replays of recorded client packets, replays with bytes altered, and random payloads of set lengths. The server's reaction (timeout, RST or FIN, and after how many bytes) differed by implementation and cipher and confirmed Shadowsocks.

From November 2021 the GFW added real-time blocking of fully encrypted traffic on TCP. The USENIX Security 2023 paper reverse-engineered the rule: a connection is exempt if its first packet has an average popcount per byte of 3.4 or less or 4.6 or more, starts with six printable ASCII bytes, is more than half printable, contains more than 20 contiguous printable bytes, or matches a TLS or HTTP fingerprint. Everything else is a candidate, and about 26% of candidate connections were blocked, on specific data-centre IP ranges. Shadowsocks, VMess and obfs4 all fall into that net.
Shadowsocks 2022 (SIP022) is the edition to run. It mandates replay protection (a timestamp that must be within 30 seconds plus a salt pool), and uses BLAKE3 key derivation in place of the old HKDF-SHA1. It still looks fully encrypted, so it still meets the 2021 heuristic. Fast and simple; use it as a fallback or where the censor is less capable than the GFW.
Trojan
Trojan runs a real TLS server with a real certificate on 443. After the TLS handshake, the client's first bytes are the 56-character hex SHA-224 of the password, a CRLF, a SOCKS5-like request, another CRLF and the payload. If the first packet does not carry a valid hash, the server hands the decrypted stream to a fallback (by default a local web server on port 80), so a prober sees an ordinary website.
Its weak points are outside the protocol. The client's TLS ClientHello must match a common browser or it is easy to single out, which is why clients use uTLS. You need a domain and certificate, and the domain's history is visible. And TLS carried inside TLS has a recognisable rhythm: the USENIX Security 2024 paper on encapsulated TLS handshakes detected every obfuscated proxy it tested in standard configuration (23 setups, including Shadowsocks, VMess, Trojan and VLESS) with true positive rates above 70%, with a false positive rate of at most 0.0544% on live ISP traffic. Random padding alone did not defeat it, and multiplexing several streams in one connection helped most.
VLESS with REALITY
VLESS is Xray's lightweight proxy protocol with no encryption of its own; it relies on the layer beneath. REALITY is that layer. It replaces the server's TLS stack with one that borrows a real third-party site's handshake. You configure a target (a real site, such as a large foreign domain that supports TLS 1.3 and HTTP/2) and the serverNames clients may use.
A client holding the server's x25519 public key authenticates inside its own ClientHello, and an authenticated client receives a temporary certificate signed with a temporary authentication key. Any connection the server cannot authenticate is forwarded byte for byte to the real target, so an active prober completes a genuine TLS handshake with the real site and sees its real certificate. You need no domain and no certificate of your own.
Pair it with the xtls-rprx-vision flow, which pads the inner TLS handshake to blunt the TLS-in-TLS rhythm above; the REALITY README warns that using it with non-XTLS protocols leaves a clear, already-targeted signature. Vision lowers the detection rate: the 2024 study still caught about 51% of Vision flows, because its padding leaves packet order and direction intact. Set the client fingerprint to a browser such as chrome.
Failure modes come from the disguise. A target that redirects (a bare domain that sends you to www) or lacks TLS 1.3 breaks it. A server IP in a cheap hosting range claiming to be a large CDN-hosted site is a mismatch any observer who checks IP ownership can see, which is why the README recommends a target whose IP is close to your server. Rate-limiting the fallback is itself a fingerprint.
Hysteria2
Hysteria2 runs over QUIC and presents itself as an HTTP/3 server on UDP 443. The client authenticates with an HTTP/3 POST /auth carrying a Hysteria-Auth header, and the server replies with status 233 only on success. Anything else gets the configured masquerade: a 404, static files, a fixed string, or a reverse-proxied real website.
Its speed comes from Brutal congestion control, which sends at the rate you configure and does not back off on packet loss or RTT changes. On lossy long-haul links that beats TCP-based transports by a wide margin. It also means a misconfigured bandwidth figure causes heavy loss, and the traffic is unfair to everything else on the link. Leave bandwidth unset to fall back to BBR.
The risk is UDP and QUIC themselves. Many ISPs throttle sustained UDP, and since April 2024 the GFW has blocked QUIC connections by decrypting the Initial packet and matching the SNI against a blocklist (USENIX Security 2025). The Salamander obfuscation option scrambles every packet into random bytes, which defeats QUIC-specific blocking but means the server no longer works as an HTTP/3 server. You choose one disguise: HTTP/3 lookalike or random UDP.
obfs4
obfs4 is a Tor pluggable transport. The client needs the bridge's node ID and public key, distributed in the bridge line. Its handshake sends a Curve25519 key encoded with Elligator 2, so the key is indistinguishable from random bytes, plus random padding and a MAC keyed by the node ID and public key. A prober without those values cannot produce a valid handshake and gets no answer. iat-mode optionally randomises packet timing.
It is strong against probing and has the same weakness as Shadowsocks: it looks fully encrypted, which the GFW heuristic catches. In practice bridges are lost more often by IP enumeration than by protocol detection. Tor now also offers Snowflake and WebTunnel for networks where obfs4 is blocked.
Test what a server you run looks like from outside with the VPN endpoint prober, which sends real WireGuard, OpenVPN, IKEv2 and TLS handshakes and runs China reachability checks for Shadowsocks, Trojan, REALITY and Hysteria2.
Comparison table
| Protocol | Transport | Speed | Passive DPI | Active probing | Main failure | Pick it when |
|---|---|---|---|---|---|---|
| WireGuard | UDP | Very high (kernel) | Easy: fixed type bytes and sizes | Silent without server public key | UDP blocked; MTU black holes | Default for any tunnel you control |
| OpenVPN UDP | UDP 1194 | High with DCO, moderate without | Moderate: opcode byte, packet sizes | Drops packets without tls-auth or tls-crypt key; close behaviour still fingerprintable | Option mismatch disables DCO | Existing PKI; features WireGuard lacks |
| OpenVPN TCP | TCP 443 | Low on lossy links | Moderate | Drops packets without tls-auth or tls-crypt key; close behaviour still fingerprintable | TCP meltdown | Only TCP 443 gets out |
| IKEv2/IPsec | UDP 500/4500, ESP | Very high (kernel) | Trivial: ports and cleartext header | Answers any IKE_SA_INIT | UDP blocked; IKE fragmentation | Native clients, MDM, vendor interop |
| SSTP | TCP 443, TLS | Low to moderate | Looks like TLS | Answers fixed SSTP request | TCP meltdown | Windows on HTTPS-only networks |
| L2TP/IPsec | UDP 500/4500/1701 | Moderate | Trivial | Answers | Shared PSK, NAT trouble | Never for new setups |
| PPTP | TCP 1723, GRE | Moderate | Trivial | Answers | Broken crypto | Never |
| Shadowsocks 2022 | TCP/UDP, any port | High | Random-looking, caught by entropy rules | Consistent, replay-protected | GFW fully encrypted heuristic | Fallback; weaker censors |
| Trojan | TCP 443, TLS | High | TLS, but TLS-in-TLS rhythm | Falls back to a website | Client TLS fingerprint; needs domain | You own a domain and want simple |
| VLESS + REALITY + Vision | TCP 443, TLS | High | Borrowed real TLS handshake | Forwards to real target site | Bad target choice; IP and SNI mismatch | Strongest TCP option against the GFW |
| Hysteria2 | UDP 443, QUIC | Very high on lossy links | HTTP/3, or random with Salamander | Masquerade site or 404 | UDP throttling; QUIC SNI blocking | Lossy links where UDP gets through |
| obfs4 | TCP, any port | Moderate (Tor) | Random-looking | Silent without bridge line | Entropy heuristic; bridge IP lists | Reaching Tor |
How to choose by threat model
Name the adversary first, then pick.
- Untrusted Wi-Fi and your own ISP. No one is trying to block you. Use WireGuard. Use IKEv2 if you need the built-in client on a managed device.
- Restrictive corporate or hotel network that allows only TCP 80 and 443. OpenVPN on TCP 443 with tls-crypt, or SSTP on Windows. Both suffer TCP meltdown, so expect lower speed on bad links.
- Company remote access. WireGuard (or a WireGuard-based mesh with central key management) when you control the client, IKEv2 with certificates or EAP when devices are managed by MDM. Keep the gateway patched; the appliance is the usual entry point.
- National censor with DPI and active probing (China, Iran, Russia). VLESS with REALITY and Vision on TCP 443 as the primary, Hysteria2 as a second path where UDP works, Shadowsocks 2022 as a third. Keep more than one ready, because a transport that works this month may not next month.
- An adversary that can compel or watch the server. No protocol choice helps, because the endpoint sees your traffic. That is a job for Tor, with obfs4, Snowflake or WebTunnel to reach it.
The VPN chooser asks six questions about who you are hiding from and where you connect, and returns one approach with its limits and OONI data on which providers get through in your country.
Common WireGuard config mistakes
WireGuard has few settings, so a broken tunnel usually traces to one of these.
AllowedIPs: full tunnel versus split
AllowedIPs = 0.0.0.0/0, ::/0 on the client sends everything through the tunnel. Two mistakes are common.
Leaving out ::/0. With only 0.0.0.0/0, IPv6 traffic takes the normal route and leaks. If the server has no IPv6, still include ::/0 so IPv6 is captured and dropped inside the tunnel.
Excluding the LAN by hand. To reach a printer at 192.168.1.20 while tunnelling everything else, you need the complement of 192.168.1.0/24, which is 24 prefixes:
AllowedIPs = 0.0.0.0/1, 128.0.0.0/2, 192.0.0.0/9, 192.128.0.0/11,
192.160.0.0/13, 192.168.0.0/24, 192.168.2.0/23, 192.168.4.0/22,
192.168.8.0/21, 192.168.16.0/20, 192.168.32.0/19, 192.168.64.0/18,
192.168.128.0/17, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14,
192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7,
196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, 224.0.0.0/3(Write it on one line in a real config.) Getting one prefix wrong leaves a hole or swallows the LAN, and the list above has a second trap on Linux. With no /0 in AllowedIPs, wg-quick installs each prefix as a plain route on the WireGuard interface, so the VPN server's own public IP falls inside the tunnel and the encrypted packets loop back into it: the tunnel never comes up. Exclude the server's endpoint address as well (compute the complement of both 192.168.1.0/24 and <server-ip>/32). With 0.0.0.0/0, Linux wg-quick uses policy routing (suppress_prefixlength 0) that already leaves directly connected LAN routes reachable, so the hand-built list is mainly for phones and other clients without that behaviour. The AllowedIPs calculator produces the minimal list for any set of exclusions, IPv4 and IPv6, and tests an address against it. On the Windows client, a split list also removes the "Block untunneled traffic" option, which the client offers only for a catch-all route.
On the server side, each client peer needs its own address, usually a single /32. If two peers list the same range, the range moves to whichever peer was configured last, and traffic for the first one silently goes to the second.
DNS
The DNS = line is applied by wg-quick through resolvconf, which on systemd-resolved systems is the resolvconf shim that resolved provides. Three failures recur:
- No DNS line on a full tunnel. Queries go to whatever resolver the OS already had, often the LAN router, which forwards them to the ISP.
- A DNS server outside AllowedIPs. On a split tunnel with
AllowedIPs = 10.8.0.0/24andDNS = 10.10.0.53, the resolver is unreachable and every lookup fails. Add the resolver's address to AllowedIPs. resolvconf: command not foundon minimal Linux installs. wg-quick aborts bringing the interface up. Installopenresolv, or on systemd-resolved systems make sure itsresolvconfcompatibility link is installed.
How to test for a leak is covered in the DNS leak section of What Is a VPN.
MTU
The default of 1420 assumes a 1500-byte path. Anything that adds its own header lowers the real ceiling: PPPoE (1492), many mobile networks, and any tunnel nested inside another. The symptom is distinctive: the handshake completes, ping works, SSH works, and HTTPS pages or large downloads stall.
Worked example for a client on PPPoE with an IPv6 path to the server: 1492 minus 80 bytes of WireGuard, UDP and IPv6 overhead gives MTU = 1412. TCP traffic forwarded by the server should then have its MSS clamped to the tunnel MTU minus 40 bytes for IPv4 (1372) or 60 for IPv6 (1352). The VPN MTU and MSS calculator itemises every overhead byte for WireGuard, OpenVPN, IPsec and stacked tunnels and prints the config lines.
PersistentKeepalive
WireGuard sends nothing when idle. A peer behind NAT that is never the first to talk loses its NAT mapping within a minute or two, and the other side can no longer reach it. PersistentKeepalive = 25 on that peer keeps the mapping open; 25 seconds is the value the WireGuard documentation recommends for a wide range of firewalls.
A laptop that always initiates does not need it, and on a phone it wakes the radio every 25 seconds. Set it on peers behind NAT that must accept inbound connections (a home server, a site-to-site box behind CGNAT), and leave it off elsewhere.
Key reuse
Copying one client config, with its private key, to a laptop and a phone makes both devices the same peer. The server tracks one endpoint per public key and updates it to whichever device sent the latest authenticated packet, so the two devices keep taking the session from each other and both see intermittent drops. Generate a key pair and an address per device.
Related mistakes: reusing the server's key pair across several servers (one compromised host exposes all of them), and storing private keys in a repo or a shared drive. The PresharedKey is per peer pair, and a single PSK shared by every client reduces its value to that of a group password.
Run any config through the VPN config auditor, which grades it 0 to 100, explains each weak setting and produces a hardened copy without sending the config anywhere.
Verdict
For a tunnel you control on a network that leaves UDP alone, use WireGuard and spend your attention on AllowedIPs, DNS and MTU. Use IKEv2 where native clients and device management matter, and OpenVPN 2.6 with DCO and tls-crypt where you already have one or need TCP 443. Retire PPTP and L2TP. Against a censor, the classic protocols are all identifiable, so use the transports in the threat-model list above and keep more than one ready.
Related guides
Sources & further reading
- WireGuard: Next Generation Kernel Network Tunnel (whitepaper) (Jason A. Donenfeld)
- WireGuard Protocol and Cryptography (WireGuard Project)
- WireGuard Quick Start (WireGuard Project)
- OpenVPN 2.6 manual: TLS options (tls-auth, tls-crypt, tls-crypt-v2) (OpenVPN)
- OpenVPN data channel offload (README.dco) (OpenVPN)
- OpenVPN DCO Added to Linux Kernel for Built-In Speed and Security (OpenVPN)
- RFC 7296: Internet Key Exchange Protocol Version 2 (IKEv2) (IETF)
- RFC 3948: UDP Encapsulation of IPsec ESP Packets (IETF)
- RFC 4555: IKEv2 Mobility and Multihoming Protocol (MOBIKE) (IETF)
- RFC 7383: IKEv2 Message Fragmentation (IETF)
- [MS-SSTP]: Secure Socket Tunneling Protocol (Microsoft)
- PPTP and L2TP deprecation: A new era of secure connectivity (Microsoft)
- Security Advisory 2743314: Unencapsulated MS-CHAP v2 Authentication Could Allow Information Disclosure (Microsoft)
- OpenVPN is Open to VPN Fingerprinting (USENIX Security 2022) (USENIX)
- How China Detects and Blocks Shadowsocks (IMC 2020) (GFW Report)
- How the Great Firewall of China Detects and Blocks Fully Encrypted Traffic (USENIX Security 2023) (GFW Report)
- Fingerprinting Obfuscated Proxy Traffic with Encapsulated TLS Handshakes (USENIX Security 2024) (USENIX)
- Exposing and Circumventing SNI-based QUIC Censorship of the Great Firewall of China (USENIX Security 2025) (USENIX)
- Shadowsocks 2022 Edition specification (SIP022) (Shadowsocks-NET)
- Trojan protocol (trojan-gfw)
- REALITY (Project X (XTLS))
- Hysteria 2 protocol specification (Hysteria)
- Hysteria 2 full server config (masquerade, Salamander, bandwidth) (Hysteria)
- obfs4 (The obfourscator) specification (Yawning Angel)