VPNSmith
self-host-vpnCOMP

WireGuard vs IPsec 2026: 4000 lines against 400000, and what that actually buys you

IPsec is not obsolete and WireGuard is not universally better. The honest split: where each one wins, what IKEv2 changes on mobile, and which one to self-host.

By Eric Gerard · Founder · VPNSmith - Self-host VPN & GDPR VPS specialist5 min readPhoto by Jakub Pabis via Pexels

Disclosure: This article contains affiliate links. If you buy through them we may earn a commission at no extra cost to you. We only recommend services we would use ourselves, based on published specs and public track record.

Most comparisons of these two protocols read like an argument that was settled years ago. The honest version is less satisfying and more useful: they are not competing for the same job, and the reason WireGuard wins for self-hosting is the same reason IPsec still runs half the corporate world.

The number everyone quotes, and what it actually means

WireGuard's implementation is roughly 4000 lines of code. A full IPsec stack, counting the kernel side and a key exchange daemon such as strongSwan, runs into the hundreds of thousands.

That ratio gets repeated as though small automatically meant secure. It does not. What it means is auditable. A few thousand lines can be read end to end by a competent reviewer in a reasonable time; several hundred thousand cannot. Fewer lines also mean fewer branches, and most real vulnerabilities live in branches that nobody exercised.

The cost of that smallness is the part usually left out: WireGuard achieves it by refusing to negotiate anything.

Negotiation is the whole difference

IPsec is a framework. You choose the key exchange, the cipher, the integrity algorithm, the mode, the lifetimes. That flexibility is why an IPsec tunnel can terminate on a twenty-year-old appliance and on a current cloud gateway at the same time.

WireGuard is one opinionated protocol. One handshake, one cipher suite, no options, no downgrade path. You cannot misconfigure the cryptography because there is nothing to configure.

IPsec's flexibility is its strength between vendors and its weakness in your hands. Most IPsec problems in the field are configuration problems, not cryptographic ones, and WireGuard removes that entire category by removing the choices.

Fibre patch cables photographed close up: pale blue jackets ending in white LC connectors with yellow bands, a row of them plugged into an orange rack panel with knurled metal thumbscrews, one blue connector body in sharp focus at the right and the rest of the row blurring away to the left
Fibre patch cables photographed close up: pale blue jackets ending in white LC connectors with yellow bands, a row of them plugged into an orange rack panel with knurled metal thumbscrews, one blue connector body in sharp focus at the right and the rest of the row blurring away to the left

The kind of equipment IPsec still terminates on, and the reason it is not going anywhere. Photo by Brett Sayles via Pexels.

Speed: true, but not for the reason usually given

WireGuard is generally faster, and the cause is structural rather than magical. It sits in the kernel with a short code path and uses ChaCha20-Poly1305, which performs well on processors without AES hardware acceleration, meaning routers, older devices and small ARM boards.

On a modern server CPU with AES-NI, a well-tuned IPsec setup closes most of the gap and sometimes matches it. So the fair summary is:

WireGuard is fast by default. IPsec is fast when tuned. Most deployments are not tuned.

If you are choosing a protocol for a VPS you will configure once and forget, the default matters more than the ceiling. Our WireGuard against OpenVPN benchmarks measure the same effect against the third protocol in this family.

IKEv2 is not IPsec, and the confusion costs people money

This trips up a lot of readers, including people comparing commercial VPN apps.

IPsec is the encryption layer. IKEv2 is the key exchange that sets an IPsec tunnel up. When a phone app advertises IKEv2, it means IKEv2 over IPsec.

What IKEv2 brings that matters in practice is MOBIKE: the tunnel survives a change of network address. A phone that walks out of Wi-Fi onto mobile data keeps its session instead of rebuilding it. WireGuard handles roaming differently, by accepting a peer from a new address once it authenticates, which works well but is not the same mechanism and behaves differently under aggressive carrier NAT.

If your use case is a phone that constantly changes networks, this is the one place where the IPsec family has a concrete, non-legacy argument.

So which one do you self-host?

WireGuard, unless something specific forces the other choice.

A working WireGuard configuration is about a dozen lines and two keys. The failure modes are few and legible, and our MTU guide and handshake troubleshooting cover most of what goes wrong. Every client platform has an official application.

Self-hosting IPsec means running strongSwan or Libreswan and genuinely understanding phase 1, phase 2, proposals and rekeying. That is a real investment, and it buys you nothing unless you must interoperate with equipment that already exists.

Which is exactly when you should choose it:

  • a site-to-site link to a firewall that only speaks IPsec,
  • a vendor appliance with no WireGuard support,
  • a policy requirement naming IPsec explicitly,
  • a fleet of phones roaming aggressively where MOBIKE behaviour is worth the complexity.

None of those describe a person setting up a personal VPN on a VPS, and that is the whole answer for most readers of this page.

What this comparison does not settle

It does not tell you IPsec is obsolete, and any page saying so is not looking at where it runs. IPsec carries an enormous share of site-to-site links between company networks and ships natively in most firewalls and routers. Not the right tool for you to self-host in 2026 and obsolete are different statements, and only the first one is supported here.

It also does not compare implementations. We compared protocol designs, not strongSwan against Libreswan against the kernel module, which would need a benchmark on identical hardware that we have not run. We are not going to publish a speed table we did not measure.

If you have settled on WireGuard, the next decision is where to run it, and for that the region and the network matter more than the specifications. Our ranking of the cheapest VPS for WireGuard compares providers on price and guaranteed bandwidth.

★ Nuremberg GDPR datacenter · ✓ Dedicated IPv4 included · 200+ Mbps guaranteed

Self-host your VPN on your own VPS → ContaboFull root access · public IPv4 · pick your region

Frequently asked questions

Is WireGuard better than IPsec?
For a self-hosted point-to-point tunnel, yes, in most cases: it is far simpler to configure, its codebase is roughly 4000 lines against several hundred thousand for a full IPsec stack, and it is faster to bring up. But IPsec wins in places WireGuard does not compete: it is supported natively by essentially every enterprise firewall and router, it has decades of interoperability between vendors, and IKEv2 handles moving between networks on mobile in a way WireGuard handles differently. Better depends on which of those you need.
What is the real difference between WireGuard and IPsec?
IPsec is a framework, WireGuard is one opinionated protocol. IPsec lets you negotiate ciphers, modes, and key exchange, which is why it interoperates with anything and why misconfiguring it is easy. WireGuard fixes its cryptography with no negotiation at all: one key exchange, one cipher suite, no options. That removes an entire category of downgrade and misconfiguration problems, and it also means you cannot adapt it when a peer needs something else.
Is WireGuard faster than IPsec?
Usually, and the reason is structural rather than magic: WireGuard runs in the kernel with a very short code path and uses ChaCha20-Poly1305, which is fast on CPUs without AES hardware acceleration. On modern server CPUs with AES-NI, a well-tuned IPsec setup can close most of that gap and sometimes match it. The honest summary is that WireGuard is faster by default while IPsec is faster only when tuned, and most people do not tune it.
Is IKEv2 the same as IPsec?
No, and the confusion is worth clearing up. IPsec is the encryption layer; IKEv2 is the key exchange that sets up an IPsec tunnel. When a commercial VPN app on a phone says IKEv2, it means IKEv2 over IPsec. Its notable property is MOBIKE, which lets a tunnel survive a change of network address, so a phone moving from Wi-Fi to mobile data keeps the session instead of rebuilding it.
Which one should I self-host on a VPS?
WireGuard, unless you have a specific reason not to. A working configuration is a dozen lines and two keys, the failure modes are few and legible, and every client platform has an official app. Self-hosting IPsec means running strongSwan or Libreswan and understanding phase 1, phase 2, proposals and rekeying, which is a real investment with no benefit unless you must interoperate with existing equipment.
Is IPsec obsolete?
No, and pages that claim so are not looking at where it runs. IPsec carries a very large share of site-to-site links between company networks, and it is what most firewall and router vendors ship natively. It is not the tool most individuals should self-host in 2026, which is a different statement from being obsolete.
Can WireGuard and IPsec run at the same time?
Yes. They are independent tunnels using different ports and different kernel paths, so nothing prevents a machine from terminating both. It is a common arrangement in practice: IPsec for the legacy site-to-site link that a vendor appliance requires, WireGuard for the people who connect from laptops and phones.