Privacy

What Is IKEv2? How the VPN Protocol Works and When to Use It

IKEv2 sets up and authenticates an IPsec VPN, then IPsec encrypts your traffic. Here is how the handshake works, why phones love it, and when to choose something else.

Cysoro Security TeamPublished · 7 min read
Your phone VPNVPN server IKEv2 + IPsec tunnel PRIVACY What is IKEv2? The VPN protocol built into your phone.
Quick answer

IKEv2 (Internet Key Exchange version 2) is the protocol that sets up, authenticates and maintains an IPsec VPN connection. It negotiates encryption algorithms, proves the identity of both sides and agrees on fresh keys, usually in four messages. IPsec then encrypts the actual traffic with those keys. IKEv2 is built into Windows, macOS, iOS and Android, and its MOBIKE extension keeps a VPN connected when a phone moves between Wi-Fi and mobile data.

Key takeaways

  • IKEv2 negotiates the VPN and its keys; IPsec (ESP) encrypts the traffic. The pair is called IKEv2/IPsec.
  • It uses UDP port 500, and UDP port 4500 when NAT is involved — which is almost always on home and mobile networks.
  • MOBIKE makes IKEv2 the most resilient VPN protocol on phones, surviving network switches without reconnecting.

Open the VPN settings on an iPhone or an Android phone and IKEv2 is already there, waiting. It is the protocol behind most work VPNs, many commercial VPNs and even Wi-Fi calling — and almost nobody explains what it actually does.

What is IKEv2?

IKEv2 is the protocol that sets up, authenticates and maintains an IPsec VPN connection. It agrees on encryption algorithms, proves both sides are who they claim to be, and derives the keys that protect your traffic.

IKE stands for Internet Key Exchange. Version 2 was first published by the IETF in December 2005, and the current standard is RFC 7296 from October 2014, which obsoleted RFC 5996 and advanced IKEv2 to Internet Standard status.

On its own, IKEv2 carries none of your data. It runs the negotiation, and IPsec then encrypts your traffic with the agreed keys. If IKEv2 is the two sides agreeing on a lock and swapping keys, IPsec is the locked van that carries the goods.

IKEv2 vs IPsec: what is the difference?

IKEv2 and IPsec are two different protocols that work as a pair. Confusing them is common, because VPN apps usually just say IKEv2 when they mean IKEv2/IPsec.

IKEv2IPsec (ESP)
JobSets up and authenticates the VPNEncrypts and authenticates data packets
RoleControl planeData plane
StandardRFC 7296RFC 4303 (ESP), RFC 4301 (architecture)
TransportUDP ports 500 and 4500ESP, IP protocol 50, or UDP 4500 with NAT
Carries your data?NoYes

IPsec offers two packet formats. AH (Authentication Header, RFC 4302) authenticates packets but does not encrypt them. ESP (Encapsulating Security Payload, RFC 4303) encrypts and authenticates them, and essentially every IPsec VPN uses ESP alone.

IPsec also has two modes. Transport mode encrypts only the packet payload and suits host-to-host connections. Tunnel mode encrypts the whole original packet, header included, and wraps it in a new packet addressed to the gateway — that is what people mean by a VPN.

How does IKEv2 work?

A normal IKEv2 connection takes two exchanges, four messages in total. The older IKEv1 needed six to nine messages, which is one reason IKEv2 connects faster.

The IKEv2 handshake: four messages Exchange 1 — IKE_SA_INITAgree algorithms, Diffie-Hellmanexchange, swap random numbers Exchange 2 — IKE_AUTHProve identities, set up the firstdata tunnel (Child SA) After the handshake: traffic flows as ESPKeys are replaced at intervals (rekeying) without dropping the connection.CREATE_CHILD_SA handles rekeying and extra tunnels. Everything after IKE_SA_INIT is encrypted — identities are never sent in the clear.
The IKEv2 handshake in two exchanges. Illustration by Cysoro.

IKE_SA_INIT: agree and exchange keys

Your device and the server agree on algorithms, run a Diffie-Hellman key exchange and swap random numbers called nonces. At the end of this exchange they share a secret and can encrypt, but neither side yet knows who the other is.

IKE_AUTH: prove who you are

The second exchange is encrypted under the keys just derived. Each side sends its identity and proves it, then negotiates the first Child SA — the actual ESP tunnel that carries your traffic.

The server usually proves itself with a certificate. You sign in with a username and password, a certificate of your own, or a pre-shared key. Certificate authentication is the strongest of the three.

Both sides store the agreement in a Security Association (SA): the IKE SA for the control channel and Child SAs for the data tunnels. Keys are replaced at intervals without dropping the connection, which gives the session forward secrecy when the old keys are discarded.

What ports does IKEv2 use?

IKEv2 starts on UDP port 500. When a router doing NAT sits between your device and the server — which is nearly always on home and mobile networks — both the IKE messages and your data move to UDP port 4500, with ESP packets wrapped inside UDP.

Without NAT, data travels as ESP (IP protocol 50), which is not a port at all. That detail matters when you configure a firewall: allowing UDP 500 and 4500 is usually enough, but some strict firewalls also need to allow ESP directly.

This fixed-port design is also IKEv2's main weakness on restrictive networks. A firewall can block it simply by dropping UDP 500 and 4500, and deep packet inspection can recognize it from its header because it has no obfuscation.

Why is IKEv2 so good on mobile?

Two extensions explain why mobile operating systems settled on IKEv2 rather than something newer. The first is NAT traversal, described above. The second is MOBIKE.

MOBIKE (RFC 4555) lets an established tunnel change its outer addresses without renegotiating. When your phone moves from Wi-Fi to mobile data, its IP address changes, and most VPN protocols drop and reconnect. With MOBIKE, the IKEv2 tunnel survives the switch.

That resilience is why IKEv2 is the default for many corporate VPNs and for carrier features such as Wi-Fi calling. A dropped VPN on a moving phone is not just annoying — it can briefly expose traffic outside the tunnel.

If your VPN keeps dropping on your phone, check whether it is using IKEv2. You can also check what your connection looks like from the outside with our free what-is-my-IP tool.

Is IKEv2 secure?

Yes, with modern settings. The protocol is sound when the server uses a strong Diffie-Hellman group such as P-256 (Group 19), AES-GCM or ChaCha20-Poly1305 encryption, and certificate authentication; weak configurations are the risk, as RFC 7296's security considerations describe.

What to watch for:

  • Pre-shared keys: a short or shared pre-shared key is the weakest authentication option and should be avoided where certificates are possible.
  • Old Diffie-Hellman groups: small groups such as 768-bit MODP are banned in current IETF guidance.
  • Old ciphers: DES and MD5 are banned in the same guidance; use AES and SHA-2 instead.
  • Unpatched implementations: IKEv1 is deprecated — the IETF moved it to Historic status — and old IKEv1-only systems should be upgraded or replaced.

IKEv2 vs WireGuard vs OpenVPN

Most VPN apps today offer two or three protocols. Here is how IKEv2 compares to the other common choices.

IKEv2/IPsecWireGuardOpenVPN
Built into OSYes — Windows, macOS, iOS, AndroidNo, needs an app or kernel moduleNo, needs an app
Speed to connectFast, four messagesVery fastSlower, TLS handshake
Network switchingExcellent, MOBIKEGood, stateless designReconnects
ObfuscationNone by defaultNone by defaultPossible with plugins
Firewall blockingEasy to block by portEasy to block by portHarder, can use TCP 443
Code sizeLarge, complexSmall, easy to auditLarge

WireGuard is simpler, faster to connect and easier to audit, which is why most privacy-focused providers now lead with it. OpenVPN is the most flexible on restrictive networks because it can run over TCP port 443 and look like ordinary web traffic. IKEv2 wins when you need native OS support, flexible authentication or the most resilient mobile connection.

For a fuller picture of the privacy side, see our guide to how to secure your Wi-Fi, which covers what a VPN can and cannot protect on a public network.

Which protocol fits your situation? IKEv2/IPsecPick it for: work VPNs,phones, native OS setup,network switchingWatch out: easy to block WireGuardPick it for: speed,simplicity, privacy VPNs,easy auditingWatch out: needs an app OpenVPNPick it for: restrictivenetworks, TCP 443,maximum flexibilityWatch out: slower setup There is no single best protocol — match it to your network and your device.
Choosing between IKEv2, WireGuard and OpenVPN. Illustration by Cysoro.

When should you use IKEv2?

Use IKEv2 when you want a VPN built into your operating system, when you move between networks a lot, or when your employer or VPN provider offers it as the native option. It is a strong default for phones and laptops.

Choose something else when you are on a network that blocks VPNs by port, when you need obfuscation to get past a national or corporate firewall, or when your provider's WireGuard option is faster and simpler for your use.

Also remember that a VPN protocol is only one layer. It hides your traffic from the local network and your internet provider, but it does not make you anonymous, stop tracking cookies, or protect you from phishing. See our spear phishing guide for the threats a VPN does not stop.

How do you set up IKEv2?

Because IKEv2 is built in, setup is usually a manual configuration in your operating system settings. Your VPN provider or IT team gives you a server address, a remote ID, and either a username and password or a certificate.

  1. On iOS: Settings, General, VPN & Device Management, Add VPN Configuration, then choose IKEv2 and enter the server and credentials.
  2. On Android: Settings, Network & internet, VPN, add a new profile and choose IKEv2/IPsec, then enter the server and credentials.
  3. On Windows: Settings, Network & internet, VPN, Add VPN, choose IKEv2 as the VPN type and enter the server and credentials.
  4. On macOS: System Settings, Network, add a VPN and choose IKEv2, then enter the server and credentials.

After connecting, verify the tunnel is actually carrying your traffic: check your IP address and run a DNS leak test. Our free WebRTC leak test shows whether your real address is leaking through the browser.

Check the server certificateWhen you set up IKEv2 manually, confirm the server address and certificate details with your provider or IT team. A wrong server address is the easiest way to connect to a fake VPN.

The bottom line

IKEv2 is the quiet workhorse of VPNs: it negotiates the connection and the keys, IPsec encrypts the traffic, and MOBIKE keeps the tunnel alive when your phone changes networks. It is fast, widely supported and secure when configured with modern algorithms.

Pick IKEv2 for native, resilient mobile VPNs. Pick WireGuard for speed and simplicity, or OpenVPN when a restrictive network forces you onto TCP 443. Whichever you choose, verify the tunnel is working with our free IP checker after you connect.

Frequently asked questions

What does IKEv2 stand for?

IKEv2 stands for Internet Key Exchange version 2. It is the second version of the Internet Key Exchange protocol, standardized by the IETF in RFC 7296 in October 2014.

Is IKEv2 the same as IPsec?

No. IKEv2 is the control plane: it authenticates both sides and negotiates the keys. IPsec, using ESP, is the data plane: it encrypts and authenticates the traffic. A VPN needs both, which is why the pair is usually called IKEv2/IPsec.

What ports does IKEv2 use?

IKEv2 starts on UDP port 500. When network address translation (NAT) is detected between the device and the server, the traffic moves to UDP port 4500, with ESP packets wrapped inside UDP. Without NAT, data travels as ESP, which is IP protocol 50, not a port at all.

Is IKEv2 secure?

Yes, when it is configured with modern algorithms. With certificate authentication, a strong Diffie-Hellman group such as P-256, and AES-GCM or ChaCha20-Poly1305 encryption, IKEv2 has no known practical attack. Weak settings, such as pre-shared keys or old groups, are the real risk.

Is IKEv2 better than WireGuard?

Neither is better for everyone. IKEv2 is built into every major operating system, handles network changes well and supports flexible authentication. WireGuard is simpler, faster to connect and easier to audit, and most privacy VPN apps now lead with it. Choose IKEv2 when you need native OS support or MOBIKE.

Why is IKEv2 good on mobile phones?

Because of MOBIKE, an extension defined in RFC 4555. It lets an established tunnel change its network address without renegotiating, so the VPN survives a switch from Wi-Fi to mobile data without dropping.

Can IKEv2 be blocked?

Yes. IKEv2 normally uses UDP ports 500 and 4500 and has no obfuscation, so a firewall can block it by port and deep packet inspection can recognize it. On a restrictive network, a VPN protocol with obfuscation or TCP support usually works better.

Do I need a VPN app to use IKEv2?

No. Windows, macOS, iOS and Android all include native IKEv2 support, so you can set up a manual IKEv2 connection in the operating system settings without installing an app, as long as you have the server address and credentials.

Sources

  1. IETF — RFC 7296: Internet Key Exchange Protocol Version 2 (IKEv2)
  2. IETF — RFC 4555: IKEv2 Mobility and Multihoming Protocol (MOBIKE)
  3. Microsoft Learn — Create Always On VPN Connection on Windows Client Devices
  4. strongSwan — Introduction to strongSwan
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against RFC 7296, the IETF standard for IKEv2, RFC 4555 for MOBIKE, Microsoft Learn's IKEv2 VPN setup guide for Windows, and the strongSwan documentation.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free