On this page
Facts
What it is
VPN: IPsec tunnel with IKEv2 key exchange
Since, by
2005, IETF (RFC 4306); current text RFC 7296, 2014
Transport
UDP 500 and 4500, or bare ESP; TCP per RFC 9329
Encryption
Negotiated suites such as AES-GCM or ChaCha20-Poly1305
To the network it looks like
IKE and ESP packets, recognisable by their headers
Usual port
UDP 500, then UDP 4500 behind NAT
Comes as
System VPN settings, a profile, or swanctl.conf
License
Open standard; strongSwan and libreswan are GPLv2
Latest release
strongswan 6.1.0, September 7, 2026
In Veli
Not supported
Versions and history
- 1998
IKEv1
RFC 2409 defines the first Internet Key Exchange. It is Historic now: RFC 9395 (2023) tells systems that speak only IKEv1 to move to IKEv2.
- 2005
IKEv2, ESP and NAT traversal
RFC 4306 brings IKEv2 in December and RFC 4303 the current ESP the same month. RFC 3948, from January, wraps ESP in UDP 4500 so that it passes NAT.
- 2006
MOBIKE
RFC 4555 lets an IKEv2 tunnel change its outer IP addresses without being built again.
- 2009
Windows 7
IKEv2 with MOBIKE reaches Windows 7 and Windows Server 2008 R2, where Microsoft calls it VPN Reconnect.
- 2014
RFC 7296
The revised IKEv2 text becomes an Internet Standard, STD 79.
- 2020
Android 11
Android gets an IKEv2 client of its own; both the system settings and apps can create IKEv2/IPsec VPNs.
- 2022
IKEv2 over TCP
RFC 9329 carries IKE and ESP in one TCP connection, for networks that drop UDP.
How IKEv2/IPsec works
IKE and IPsec split the work. IKE is the conversation that agrees on keys; ESP carries the traffic. In the usual case the conversation takes four messages. The first pair, IKE_SA_INIT, offers cipher suites, swaps random nonces and runs a Diffie-Hellman exchange. It travels unencrypted, because no key exists yet. The second pair, IKE_AUTH, is already encrypted: both sides send their identities, prove them with a certificate, a shared key or EAP, and set up the first Child SA, the pair of one-way keys that ESP will use.
From then on the tunnel is plain ESP. Each packet gets a short header with an SPI, the number that names the key, and a sequence number against replays; the rest, including the original IP packet, is encrypted and authenticated. On a direct path ESP is an IP protocol of its own, number 50. When IKE finds a NAT on the way (each side sends hashes of the address and port it sends from and the one it sends to, NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP, and the other compares them with what arrived), both move to UDP port 4500 and wrap ESP in UDP, as RFC 3948 describes. IKE messages on port 4500 begin with four zero bytes, so the receiver can tell them from ESP.
Keys are renewed with CREATE_CHILD_SA exchanges, and INFORMATIONAL messages check that the peer is alive and close the tunnel. Unlike L2TP/IPsec, SSTP and PPTP, there is no PPP inside: the system receives IP packets directly, one layer of headers fewer.
MOBIKE: why the tunnel survives a change of network
A phone that leaves Wi-Fi gets a new IP address. Most tunnels die at that moment and are built again from scratch. MOBIKE (RFC 4555) changes only the outer addresses: the client sends an INFORMATIONAL request with an UPDATE_SA_ADDRESSES notification, and the same keys and the same inner addresses carry on. Apps inside the tunnel keep their connections.
Microsoft shipped this in Windows 7 as VPN Reconnect and describes the case of unplugging a laptop, walking to a meeting room and joining Wi-Fi with the tunnel still up; its documentation adds that hibernation does drop it. Apple lists MOBIKE among the IKEv2 features of iOS, iPadOS and macOS. strongSwan runs MOBIKE by default, and with it on moves to UDP 4500 from IKE_AUTH even without NAT, so that port has to be open on the server's firewall.
Login: certificates, EAP-MSCHAPv2, shared key
RFC 7296 knows three ways to prove identity: a signature made with a certificate's key, a pre-shared key, and EAP. With EAP the client leaves out its own proof and runs an EAP method inside the encrypted IKE_AUTH, but the server must still sign with its certificate. That is the usual company setup: the server shows a certificate, the user types a name and a password.
- Certificates: both sides sign. The strongest option and the most work: every device needs its own certificate and must trust the root that issued the server's.
- EAP-MSCHAPv2: name and password, plus the server certificate. The same MS-CHAPv2 that is broken in PPTP runs here inside IKE's encryption, and Microsoft's 2012 advisory on the PPTP attack names IKEv2 with EAP-MSCHAPv2 among the safer choices.
- Pre-shared key: one string on both ends. Easy to set up, and exactly as strong as that string: whoever knows it can pass for either side.
- On devices: Android's system settings offer a name and password (MSCHAPv2), a pre-shared key or an RSA certificate; Apple lists a shared secret, RSA and ECDSA certificates, EAP-MSCHAPv2 and EAP-TLS, and from version 26 an extra ML-KEM key exchange; Windows takes EAP or a machine certificate.
- Weak defaults: strongSwan's documentation warns that the Windows client offers 3DES, SHA-1 and the deprecated
modp1024group unless told otherwise;Set-VpnConnectionIPsecConfigurationsets AES-GCM and ECP groups instead.
A strongSwan server, field by field
IKEv2 has no share link. On the client it is a few fields in the system settings; on a Linux server the most common open-source daemon is strongSwan (GPLv2, started in 2005 as a fork of FreeS/WAN), configured in swanctl.conf. Below is a server for name-and-password logins, in the shape of strongSwan's own example for Windows clients; names, addresses and the password are made up. sudo swanctl --load-all reads the file again, sudo swanctl --list-sas shows live tunnels.
libreswan, the other open-source IPsec daemon on Linux (GPLv2, shipped in Fedora and RHEL), uses its own ipsec.conf with keys such as leftauth and rightauth, but speaks the same IKEv2.
connections.rw.poolsExample
ipv4What it doesWhich address pool clients get inside the tunnel
local.authExample
pubkeyWhat it doesThe server proves itself with its certificate; required when clients log in with EAP
local.certsExample
server.pemWhat it doesThe server certificate; the name clients type must be in its subjectAltName
local.idExample
vpn.example.comWhat it doesThe identity the server presents and clients check
remote.authExample
eap-dynamicWhat it doesClients log in over EAP, the method agreed during login (EAP-MSCHAPv2 for a password)
remote.eap_idExample
%anyWhat it doesAsk each client for its EAP name instead of fixing one
children.rw.local_tsExample
0.0.0.0/0, ::/0What it doesWhat is reachable through the tunnel: here, everything
pools.ipv4.addrsExample
10.10.10.0/24What it doesInner addresses handed to clients
pools.ipv4.dnsExample
10.10.10.1What it doesDNS server pushed to clients
secrets.eap-aliceExample
id = alice,secret = Ex4mple-onlyWhat it doesOne user's name and password
What a censor sees
IKEv2 makes no attempt to look like anything else. Every session starts with an IKE_SA_INIT request to UDP port 500 in a fixed layout: an 8-byte initiator SPI, an 8-byte responder SPI that must be zero, a version byte for major version 2, exchange type 34, then the cipher proposals in clear text. A filter needs no statistics to spot it; the RFC is enough. After a NAT the conversation moves to UDP 4500, where IKE messages start with four zero bytes and ESP packets with their SPI and sequence number. Without NAT, ESP is IP protocol 50, which a firewall can drop by number alone.
IKEv2 over TCP (RFC 9329) changes nothing here: the stream must begin with the six ASCII bytes IKETCP, and the RFC itself notes that operators can filter on that prefix. It exists for networks that drop UDP, not for hiding.
The published evidence is from Russia. Roskomsvoboda's report of October 2023 collects user reports of IPsec and IKEv2 failing on corporate networks in western Siberia and southern Russia in 2022, in eastern regions such as Altai, Omsk and Novosibirsk in January 2023, and on the large carriers for about a day on 30 and 31 May 2023. It also quotes tests by the author of GoodbyeDPI from August 2023: on Tele2 mobile in Saint Petersburg, IPsec packets on UDP 500 and 4500 were dropped after the first few packets of the handshake, while on an MTS landline in Kuzbass IPsec still passed. These are user reports and one person's tests, not a controlled measurement. For China and Iran we know of no published study that looks at IKEv2 itself.
Strengths and weaknesses
Strengths
- Built into Windows, macOS, iOS, iPadOS and Android 11 and later: nothing extra to install.
- MOBIKE keeps the tunnel and the apps' connections when the network changes.
- An open IETF standard: routers, firewalls and cloud gateways from different vendors talk to each other.
- Certificates and EAP fit company logins; Apple's version 26 systems add an ML-KEM key exchange.
- No PPP inside, so fewer headers per packet than L2TP/IPsec.
Weaknesses
- Recognisable from the first packet, and ports 500 and 4500 are easy to block.
- Many parameters to get right; the Windows client proposes weak groups unless configured.
- Certificates have to be issued, installed on every device and renewed.
- Needs UDP; the TCP mode of RFC 9329 works only where both ends support it.
Sources
- RFC 7296: Internet Key Exchange Protocol Version 2 (IKEv2)
- RFC 4303: IP Encapsulating Security Payload (ESP)
- RFC 4555: IKEv2 Mobility and Multihoming Protocol (MOBIKE)
- RFC 9329: TCP Encapsulation of IKE and IPsec Packets
- strongSwan docs: server configuration for EAP with passwords
- strongSwan docs: Windows clients and their default proposals
- Apple Platform Security: VPN security
- Roskomsvoboda: VPN in Russia, from blocking services to blocking protocols