Skip to content

Original privacy and security research, news and free tools since 2018, cited by the FBI, CISA and the World Economic Forum See our research

Cited by the FBI, CISA and the World Economic Forum

Guide

What Is an IPsec VPN? How It Works, Where It’s Used, and Its Weak Spots

Published Updated

Miklos Zoltan

By Miklos Zoltan

Founder - PrivacyAffairs

Laura Bede

Fact-Checked this

An IPsec VPN is a VPN built on IPsec, a set of internet standards that encrypt and authenticate every IP packet between two points, such as two office networks or your laptop and your company’s gateway.

It’s the workhorse of business networking. Branch offices, cloud connections and many corporate laptops rely on it, usually without anyone noticing. In consumer VPN apps it mostly shows up as “IKEv2”, and there it’s losing ground to WireGuard.

We rewrote this page in November 2026. Facts were checked on 16 November 2026.

What is IPsec?

IPsec (Internet Protocol Security) isn’t one protocol but a suite of them, standardised by the IETF. The first specifications appeared in 1995; the architecture in use today is described in RFC 4301 from 2005. It works at the network layer, so it protects all traffic between two endpoints, whatever app produced it. Your browser, email client or backup software doesn’t need to know it’s there.

The parts that matter:

  • ESP (Encapsulating Security Payload) encrypts the data and checks that nobody changed it on the way. Practically every IPsec VPN uses it.
  • AH (Authentication Header) checks integrity and origin but doesn’t encrypt. It also breaks when traffic passes through NAT, which most home and office routers use, so VPNs rarely bother with it.
  • IKE (Internet Key Exchange) is how the two sides prove who they are and agree on keys. IKEv2 is the current version; we explain it in our IKEv2 guide.
  • Security associations (SAs) are the agreements that come out of IKE: which algorithms, which keys, for which traffic, and for how long.

A bit of history explains why IPsec is everywhere in network gear. It was designed alongside IPv6, and IPv6 devices were once required to support it. RFC 6434 relaxed that to a recommendation in 2011, but by then every serious router and firewall had it built in.

Tunnel mode vs transport mode

IPsec can protect traffic in two ways.

Tunnel mode wraps the whole original packet, headers included, inside a new encrypted packet with a new outer header. Anyone watching the link sees only the two gateways talking to each other, not which machines behind them are communicating. Almost every IPsec VPN uses tunnel mode: office to office, office to cloud, and remote workers to the company network.

Transport mode encrypts only the payload and keeps the original IP header. It’s meant for two hosts protecting their own traffic directly, for example two servers in a data centre. The old L2TP/IPsec combination also runs IPsec in transport mode, with L2TP doing the tunnelling.

How an IPsec VPN connection is set up

The sequence looks complicated in diagrams, but the logic is simple: agree on a secure channel, use it to agree on keys for the data, then send the data.

  1. Traffic triggers the tunnel. A policy on the device or gateway says which traffic must go through IPsec, either everything or only traffic to certain networks.
  2. The two sides authenticate (IKE phase 1). In IKEv2 this takes four messages. The peers agree on algorithms, run a Diffie-Hellman key exchange and prove their identity with certificates, a pre-shared key or, for remote users, a username and password through EAP. The result is a protected IKE security association.
  3. They agree on keys for the data (phase 2). Inside that protected channel they set up a child security association for ESP, which carries the actual traffic.
  4. Data flows through ESP. Each packet is encrypted, given an integrity check and a sequence number, which stops replayed packets.
  5. Keys are renewed. The SAs expire after a set time or amount of data and are replaced without dropping the connection.

Ports. IKE uses UDP port 500. When either side sits behind NAT, IPsec switches to UDP port 4500 and wraps ESP inside UDP (NAT traversal). Without NAT, ESP travels as its own IP protocol, number 50 (AH is 51). If a firewall blocks any of these, the tunnel fails, which is the classic “the VPN connects at home but not at the hotel” problem. Our guide to VPN passthrough covers the router side.

Algorithms. The IETF’s current guidance for ESP (RFC 8221) makes AES-GCM mandatory to implement, recommends ChaCha20-Poly1305, says 3DES should no longer be used and rules out DES. Older gateways may still offer 3DES and SHA-1 for compatibility. They work, and they’re exactly what an audit flags.

Site-to-site and remote access: where you'll meet IPsec

Site-to-site. Two gateways, usually firewalls or routers, keep a permanent tunnel between two networks. Staff in the branch office reach the file server at headquarters as if it were down the corridor, and nobody runs any VPN software. Cloud connections work the same way: AWS Site-to-Site VPN is IPsec, and every connection comes with two tunnels ending in different AWS Availability Zones, so maintenance on one doesn’t cut you off. Larger companies concentrate these tunnels on a dedicated device, a VPN concentrator.

Remote access. One device connects to a gateway. This is the “work VPN” on many laptops. Windows, macOS, iOS, ChromeOS and Android all have an IKEv2/IPsec client built in, so a company can often skip installing an app. On phones launched with Android 12 or later, IKEv2/IPsec is the only type left in the built-in VPN client.

Consumer VPN apps. Here IPsec appears as IKEv2/IPsec, and it’s on the way out. Most apps now default to WireGuard or their own protocol built on it. ExpressVPN offers IKEv2 only on iOS, NordVPN has removed it from its apps, PIA dropped it on iOS in October 2026, and Proton VPN is retiring it completely by February 2027. Surfshark, CyberGhost, IPVanish and Windscribe still list it on some platforms.

L2TP/IPsec is the older remote-access option, and it’s fading too. Microsoft deprecated L2TP and PPTP on Windows Server in October 2024 and recommends IKEv2 or SSTP instead. Android phones launched with version 12 or later no longer offer it at all.

IPsec vs SSL VPN, WireGuard and OpenVPN

Each of these protocols does the same basic job. Where they differ is in where they run, how easy they are to block and how much there is to configure.

Four VPN protocols side by side: where each one runs and how easy it is to block
Protocol
Typical use
Ports
Getting past blocks
Worth knowing
IPsec (IKEv2)
Office-to-office links, cloud connections, company VPNs, some VPN apps
UDP 500 and 4500, or ESP (IP protocol 50)
Easy to spot and block; some business gateways can run it over TCP 443
Built into Windows, macOS, iOS, Android and most firewalls
SSL/TLS VPN
Remote access to company networks
TCP 443
Looks like ordinary HTTPS, so it gets through most networks
Usually needs the vendor’s own client; Fortinet replaced its SSL VPN tunnel mode with IPsec in 2025
WireGuard
The default in most consumer VPN apps
One UDP port, set by the server
Easy to block; providers add their own disguise on top
Fixed set of modern algorithms, little to configure; not an IETF standard
OpenVPN
Older VPN apps and self-hosted servers
UDP 1194 by default, or TCP 443
TCP 443 helps, but deep packet inspection can still spot it
Needs its own app; slower than WireGuard in most VPN apps
All four encrypt your traffic well when configured properly. The differences are where they run and how easily a network can stop them.
Sources: IETF RFC 4301 and RFC 7296, Fortinet FortiOS 7.6.3 release notes, WireGuard and OpenVPN documentation; checked 16 November 2026.

IPsec vs SSL VPN. For years the textbook answer was “IPsec for site-to-site, SSL VPN for remote workers”, because SSL VPNs run over TCP 443 like any website and get through almost any hotel or airport network. That line is blurring. Fortinet replaced the SSL VPN tunnel mode with IPsec in FortiOS 7.6.3 in 2025, and its IPsec can be set to run over TCP 443 instead. Existing SSL VPN settings aren’t carried over in the upgrade, so administrators had to rebuild remote access before updating.

IPsec vs WireGuard. WireGuard does one thing with a fixed set of modern algorithms and very little to configure. IPsec can negotiate dozens of algorithm combinations, which helps when connecting equipment from different vendors and hurts when someone leaves an old option switched on. WireGuard isn’t an IETF standard and isn’t built into firewalls the way IPsec is, which is why businesses still connect sites with IPsec while consumer apps have mostly moved on. Our WireGuard vs OpenVPN comparison covers the other two in detail.

Is IPsec secure?

Set up properly, with IKEv2, certificates and AES-GCM, the protocol itself has held up well: no practical attack on its encryption is publicly known. The problems come from three other places.

Old settings. Researchers showed in 2018 that IKE with a weak pre-shared key can be cracked offline by an attacker who sits in the middle of a single connection attempt (USENIX Security). IKEv1 in particular carries more of these legacy risks. A shared key that looks like a Wi-Fi password is the weak spot, not the encryption.

Bugs in the software. IPsec code is large and runs on internet-facing machines before anyone has logged in. In April 2026 Microsoft patched CVE-2026-33824, a flaw in the Windows IKE service rated 9.8 out of 10 that let an attacker run code without credentials; the US cybersecurity agency CISA added it to its list of actively exploited flaws in August. strongSwan, widely used open-source IPsec software, fixed a use-after-free bug in its IKEv2 code in September 2026.

The gateways. Firewalls and VPN appliances have become a favourite way in for attackers. Verizon’s breach report found edge devices and VPNs were the target in 22% of vulnerability exploitation in its 2025 edition, up from 3% a year before, and in its 2026 report exploited flaws overtook stolen passwords as the most common way breaches start. Not all of those flaws are in the IPsec code, but the box is the same one that runs your tunnel. A strong cipher doesn’t help much when the appliance holding the keys hasn’t been patched since spring.

For anyone running an IPsec gateway, that adds up to a short list: IKEv2 instead of IKEv1, certificates or EAP instead of shared keys, AES-GCM, no 3DES or DES, and updates installed as soon as the vendor releases them.

Quantum computers are the next item. Today’s key exchange could in theory be broken by a large enough quantum computer, and traffic recorded now could be decrypted then. RFC 9370 (2023) lets IKEv2 add extra key exchanges, and a standard for adding the post-quantum ML-KEM algorithm was approved by the IETF in 2026 and, when we checked, was still waiting for its RFC number. Apple’s IKEv2 client on iOS 26 can already use it.

Should you use IPsec in your VPN app?

Usually not, unless you have a reason. If your app offers IKEv2/IPsec, it’s secure and handles switching between Wi-Fi and mobile data well. WireGuard-based protocols do that too, and providers now build their apps around them. When Proton announced it was dropping IKEv2, it said WireGuard-based protocols perform much better and named problems in Apple’s IKEv2 implementation that can leak your real IP address.

IPsec is also easy to block. Its fixed ports and its own protocol number make it simple to spot, so it’s one of the first things to stop working on networks that filter VPNs and in countries that censor them. There you need a provider’s obfuscated servers instead. For how the protocols compare overall, see our guide to VPN protocols.

Where IPsec still makes sense for an individual is your own setup: connecting to your home router or office firewall with the client already built into your phone or laptop, no third-party app needed.

Frequently Asked Questions

Some people found answers to these questions helpful

Is IPsec a VPN?

Not on its own. IPsec is a set of protocols for encrypting and authenticating IP traffic; a VPN is the private connection you build with it. Most of the time people use the terms together, and "IPsec VPN" simply means a VPN that uses IPsec for its tunnel.


What ports does IPsec use?

UDP 500 for the key exchange and UDP 4500 when NAT is in the way, which is almost always the case on home and mobile networks. Without NAT, the encrypted data travels as IP protocol 50 (ESP). A firewall has to allow all of them for a standard IPsec VPN to connect.


Is IPsec the same as IKEv2?

No, but they usually come together. IKEv2 handles authentication and key agreement; IPsec's ESP then encrypts the traffic. That's why VPN apps list the protocol as "IKEv2/IPsec". Our IKEv2 guide covers the key exchange part.


Is IPsec better than SSL VPN?

For connecting offices and cloud networks, IPsec is the standard, and every firewall supports it. For remote workers, SSL VPNs were long easier because they run over TCP 443, but some vendors now run IPsec over that port too. Fortinet replaced its SSL VPN tunnel mode with IPsec in 2025. Either is only as safe as the gateway running it.


Is L2TP/IPsec still safe?

The IPsec part does the encryption and can still be strong, but L2TP/IPsec is a legacy setup. It often relies on a shared key, is easily blocked and is being phased out: Microsoft deprecated L2TP on Windows Server, and Android phones launched with version 12 or later no longer offer it. If you have the choice, use IKEv2/IPsec.


Can IPsec be blocked?

Yes, easily. It uses fixed UDP ports and its own IP protocol number, so a firewall or a censor can stop it without inspecting the content. Some business gateways can run IPsec over TCP 443 to get through, but consumer VPN apps rely on obfuscated servers or their own protocols instead.