Online Privacy

WireGuard vs. OpenVPN vs. IPsec

How the three main VPN technologies differ in design, speed, setup and network compatibility, and which fits your case.

Key takeaways

  • WireGuard uses a fixed set of modern cryptography and runs only over UDP, which keeps it compact and predictable.
  • OpenVPN builds on TLS, runs over UDP or TCP and offers many authentication and routing options.
  • IPsec is a family of IETF standards, with IKEv2 handling key exchange, and it's widely supported by operating systems and network equipment.
  • The protocol matters less to your privacy than who runs the server and how keys and updates are managed.

For a new setup you control on both ends, WireGuard is usually the simplest place to start: it's small, fast and easy to configure. OpenVPN is the flexible choice when you need to run over TCP, plug into username logins or support older environments. IPsec with IKEv2 is the standards-based option built into many operating systems and business firewalls.

All three can be secure when current and configured properly. The differences are mostly about design, management and what the network between you and the server will allow.

What a VPN protocol has to do

Any VPN protocol needs to handle a few jobs: prove each end is who it claims to be, agree on encryption keys, encrypt and authenticate packets, carry them across networks that include address translation and firewalls, and recover when your connection changes.

Encryption explained and Diffie-Hellman key exchange cover the underlying ideas.

WireGuard

WireGuard is a newer design that deliberately does less. It uses a fixed suite, including Curve25519 for key exchange and ChaCha20-Poly1305 for encrypting data. There's no negotiation of ciphers. If one ever proves weak, the plan is a new protocol version, not a menu of options.

Each side has a key pair. You configure a peer by its public key and list which inner addresses it may use, a setting called AllowedIPs. The same list tells your side what to route to that peer.

A minimal client configuration, with placeholder keys and documentation addresses, looks like this:

[Interface]
PrivateKey = <client-private-key>
Address = 10.10.0.2/32

[Peer]
PublicKey = <server-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.10.0.0/24
PersistentKeepalive = 25

The port shown is a common choice, not a requirement. The keepalive helps a device behind NAT stay reachable.

WireGuard has been part of the Linux kernel since version 5.6, and clients exist for Windows, macOS, iOS and Android. Its quietness is notable: a server doesn't answer packets that aren't authenticated with a known key.

The limits: it uses only UDP, so networks that block UDP block it. It has no built-in usernames, certificates or address assignment, so larger deployments rely on management tools. It doesn't try to disguise itself. And a basic server keeps a peer's most recent real address in memory, which privacy-focused providers handle with extra measures.

OpenVPN

OpenVPN has a long history and a very large set of features. It uses TLS, the technology behind HTTPS, to authenticate and exchange keys, usually with X.509 certificates, and can add username and password checks through plugins or directory services.

It runs over UDP, its better-performing mode, or TCP. Its registered port is 1194, but it can be set to others, including TCP 443, which is more likely to pass restrictive firewalls. It doesn't become identical to web traffic that way, and some filtering equipment can still tell the difference.

Running TCP inside TCP can cause stalls on lossy links, because both layers try to resend lost data. Use UDP unless the network forces your hand. TCP vs. UDP explains why.

Traditionally OpenVPN did its work in user space, outside the operating system kernel, which costs performance. Newer versions support kernel offload for the data channel on some platforms. It needs a client app on most systems, and its many options make misconfiguration easier.

IPsec and IKEv2

IPsec is a set of standards for protecting IP packets. The architecture is described in RFC 4301. The Encapsulating Security Payload (ESP, RFC 4303) encrypts and authenticates data. IKEv2 (RFC 7296) authenticates the peers and sets up keys.

IPsec has two modes. Transport mode protects the payload between two hosts. Tunnel mode wraps the whole original packet, which is typical for connecting sites or remote users.

IKEv2 uses UDP port 500, and moves to UDP 4500 when NAT is detected, with ESP wrapped inside UDP so translators can handle it. An extension called MOBIKE lets a session survive a change of address, which suits phones moving between Wi-Fi and cellular.

Its strengths are native support in many operating systems and wide use in firewalls, which makes it the usual way to link offices from different vendors. Its weakness is complexity. Both ends must agree on algorithms, identities and which traffic is covered, and error messages are often unhelpful. Old settings such as IKEv1 aggressive mode with weak shared secrets should be retired.

Design at a glance
WireGuard Fixed modern cipher suite UDP only Public keys per peer Short, simple configuration OpenVPN TLS-based, many options UDP or TCP Certificates, passwords, plugins Needs a client app IPsec / IKEv2 IETF standards family UDP 500 and 4500, ESP Certificates, shared keys or EAP Built into many systems WireGuard Fixed modern cipher suite UDP only Public keys per peer Short, simple configuration OpenVPN TLS-based, many options UDP or TCP Certificates, passwords, plugins Needs a client app IPsec / IKEv2 IETF standards family UDP 500 and 4500, ESP Certificates, shared keys or EAP Built into many systems

How a connection starts

The WireGuard handshake completes in a single round trip: the initiator sends one message, the responder replies, and encrypted data can flow. It repeats periodically to refresh keys.

WireGuard handshake, simplified
Client Server Handshake initiation 1 Proves knowledge of the client key Handshake response 2 Encrypted data packets 3 Encrypted data packets 4 Client Server Handshake initiation 1 Proves knowledge of the client key Handshake response 2 Encrypted data packets 3 Encrypted data packets 4

IKEv2 normally needs two exchanges, four messages, before data flows, with more if password-style authentication is used. OpenVPN's TLS handshake takes several messages. In daily use you'll rarely notice, except on very slow or high-latency links.

Performance in practice

WireGuard and kernel-based IPsec tend to perform well. OpenVPN without offload often uses more processor time for the same throughput. Hardware changes the picture: many processors accelerate AES, which favors AES-based IPsec or OpenVPN, while ChaCha20 runs well on devices without that help.

Your real bottleneck may be the server's distance, your upload speed or a small router's processor. Test your own path with the VPN on and off, and reduce the tunnel's MTU if large transfers stall. MTU, MSS and fragmentation explains the symptom, and the MTU planner helps with the arithmetic.

Authentication and managing many users

The protocols differ most once more than a handful of people connect.

With WireGuard, each device is a public key in a list. That's clean for a household. For fifty employees you'll want a way to generate configurations, assign inner addresses, expire access and tie keys to people. Several products build those layers on top, adding single sign-on and automatic key distribution. Judge them as software in their own right, because the management service decides which keys are trusted.

OpenVPN commonly uses a private certificate authority. Each user gets a certificate, and revoked ones go on a list the server checks. Adding a password and a one-time code through a plugin or directory is a familiar pattern.

IKEv2 supports certificates, pre-shared keys and the Extensible Authentication Protocol (EAP), which lets it hand user checks to an existing authentication server. Use long random values for any shared key, and prefer certificates for anything with more than a couple of peers, since a shared secret known to many is hard to rotate.

Getting through restrictive networks

A VPN that can't connect is no use. The blocking usually falls into a few patterns.

Some guest networks allow only web ports. WireGuard on an unusual UDP port will fail there; changing its port to another UDP number may help if UDP is allowed at all. OpenVPN over TCP 443 often connects where others don't.

Some networks allow IKEv2's UDP ports poorly, or have home routers that mishandle ESP or NAT traversal. If a tunnel connects but carries nothing, check that UDP 4500 is permitted and try a smaller MTU.

Carrier-grade NAT affects the server side. If your home connection has no publicly reachable address, a self-hosted server of any of these types can't be contacted directly without IPv6, port forwarding from your provider or a relay.

Respect the rules of networks you don't run. Getting around a deliberate block on an employer or school network may breach policy.

Troubleshooting a tunnel that won't work

Work in order. First, confirm the server's name resolves and the clock on both ends is right, since certificate checks depend on time. Next, confirm the port is forwarded and allowed by the host firewall. Then check keys or certificates for mismatches and expiry.

If the handshake succeeds but you can't reach anything, look at routing. On WireGuard, review AllowedIPs on both ends. On a gateway, make sure packet forwarding is enabled and return routes exist. Overlapping address ranges are a classic trap: if the café and your home both use 192.168.1.0/24, your device can't tell which one you mean. Choosing a less common private range at home avoids it.

Which to choose

Situation Reasonable starting point
Reaching your own home or lab WireGuard
Network that only permits TCP OpenVPN over TCP
Connecting two offices with vendor firewalls IPsec with IKEv2
Phones with no extra apps allowed IKEv2, where natively supported
Existing certificate or directory logins OpenVPN or IKEv2

For a commercial service, use what its app recommends and switch if a particular network fails. How to choose a VPN covers the bigger questions.

Keeping any of them safe

Update clients and servers promptly. Internet-facing VPN gateways are frequent targets, as why VPN appliances get attacked explains. Give each device its own key or certificate so you can revoke one. Protect private key files, require a second factor for user logins where supported and remove accounts when people leave.

Review logs for unexpected connections, and don't expose a management page to the whole internet. A well-maintained older protocol beats a neglected new one.

Common questions

Are any of these quantum-resistant?

Their classic public-key exchanges would not withstand a sufficiently capable quantum computer. WireGuard supports an optional pre-shared key that adds protection, and work on post-quantum key exchange is progressing for IKEv2 and TLS. See post-quantum cryptography and check your software's documentation.

What about PPTP and L2TP?

PPTP is considered broken and shouldn't be used. L2TP provides no encryption by itself and is paired with IPsec; plain IKEv2 is generally the cleaner choice today.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Online Privacy →

Latest news on this topic