Introduction to IKE
In 1995, RFC 2409 introduced the Internet Key Exchange, or IKE, as a solution to securely establish communication channels between two peers. Although commonly referred to as a protocol, IKE is more accurately described as an information exchange method. Its primary goals are to build a secure communication tunnel, authenticate participating peers, and agree on a security policy, all critical functions in IPSec VPNs.
The Two Phases of IKE
IKE operates in two distinct phases.
- Phase 1 focuses on establishing a secure, authenticated tunnel between peers. The result of this phase is the creation of a bidirectional ISAKMP Security Association (SA), a trusted communication channel. Phase 1 can be executed in two modes:
- Main Mode: More secure but slower, requiring six message exchanges.
- Aggressive Mode: Quicker, using only three messages. This mode is mostly used in legacy remote access scenarios with preshared keys, but it’s less common today due to its weaker security posture.
You can verify the Phase 1 status on a Cisco router with:
show crypto isakmp sa
- Phase 2 is where the actual IPSec SAs are negotiated. These define what will be encrypted and how. Only one mode, Quick Mode, is used here, and it requires three messages to complete. Quick Mode establishes two unidirectional IPSec Security Associations (SAs) for secure data transmission between peers.
To inspect Phase 2 on a Cisco router, use:
show crypto ipsec sa
Technically, a tunnel can be configured without Phase 1 by using static keys, but doing so eliminates dynamic key negotiation and significantly reduces security.
The Building Blocks Behind IKE
IKE is built on a combination of concepts:
- SKEME: A framework from which IKE took RSA-based encryption ideas.
- OAKLEY: Provided the foundation for Diffie-Hellman key exchange.
- ISAKMP (Internet Security Association and Key Management Protocol): Provided the message structure and flow.
While ISAKMP is often confused with IKE, they are not the same. ISAKMP defines the message format (Layer 7), while IKE governs how keys and policies are exchanged. In fact, IKE uses ISAKMP to establish the initial Security Association (SA), much like how FTP separates control and data channels – ISAKMP handles the control plane, and IPSec handles data encryption.
Protocols and Ports
Several IP protocols are involved in IKE/IPSec operations:
- ISAKMP uses UDP port 500 on both ends.
- ESP (Encapsulating Security Payload), used for encrypting data, operates with IP protocol 50.
- AH (Authentication Header), which is now less commonly used, runs on IP protocol 51.
- Additional relevant protocols: TCP (6), UDP (17), and ICMP (1).
Once the tunnel is established, ESP is typically used for encrypting actual data packets. ESP is preferred because it supports confidentiality, authentication, and anti-replay – all in one.
Summary of IPSec Benefits
When properly negotiated via IKE, IPSec delivers:
- Confidentiality: Data is encrypted and unreadable to attackers.
- Integrity: Ensures data is not altered in transit.
- Anti-Replay Protection: Prevents attackers from resending captured packets.
- Data Origin Authentication: Verifies the source of the communication.
IKEv1: Legacy Key Exchange and Its Limitations
Internet Key Exchange Version 1 (IKEv1) laid the groundwork for secure VPN negotiation and the establishment of IPSec tunnels. In IKEv1, Main Mode consists of six message exchanges, while Aggressive Mode condenses the process into just three messages. These exchanges use ISAKMP over UDP port 500, with support for NAT Traversal (NAT-T) operating on UDP port 4500.
While foundational, IKEv1 comes with several limitations. It operates as a “fire-and-forget” model, making it vulnerable to denial-of-service (DoS) attacks. Additionally, it lacks cryptographic integrity during the initial proposal exchange, leaving negotiation details unauthenticated and open to manipulation. IKEv1 also offers no support for VoIP environments and is not designed to support high availability, which limits its suitability for modern enterprise networks.
During tunnel establishment, the Security Association (SA) lifetime is negotiated in the first exchange messages (MM1 and MM2). For the negotiation to succeed, the responder’s lifetime must be equal to or less than the initiator’s proposal. This design constraint, along with the absence of high-availability support, has contributed to the gradual phasing out of IKEv1 in favor of IKEv2.
IKEv2: A Modern and Secure Upgrade to Internet Key Exchange
Internet Key Exchange Version 2 (IKEv2) is a significant evolution of the original IKE protocol, designed to address many of IKEv1’s shortcomings while improving efficiency, security, and flexibility. IKEv2 operates over UDP port 500, supports NAT-Traversal via UDP port 4500, and requires only 4–6 messages to establish a secure tunnel, compared to IKEv1’s 6-message minimum. It also introduces cookie-based peer verification to mitigate denial-of-service (DoS) attacks, along with built-in VoIP support and Suite B cryptography for stronger proposal protection.
Secure Proposal and Authentication Mechanisms
Unlike IKEv1, IKEv2 uses digital signatures during the second message exchange (IKE_AUTH), allowing both peers to authenticate securely. These signatures can be based on RSA (RSA-sig) or Elliptic-Curve Digital Signature Algorithm (ECDSA-sig). ECDSA has notable advantages, including faster computation and smaller key sizes, making it bandwidth-efficient and computationally light.
The signature process can be described as follows:
signature = sign(message, private_key)
The signature can be validated by the receiving peer by using the public key corresponding to the private key:
verify (message, signature, public_key) = pass | fail
In some cases, the actual certificate used for authentication may not be sent. Instead, a SHA-1 hash of the certificate and a URL to retrieve it can be exchanged, commonly known as HASH and URL or HTTP URL Lookup.
Encrypted Handshake and Secure Exchanges
After the initial handshake, all IKEv2 messages are encrypted and authenticated. The process begins with IKE_SA_INIT, where peers exchange cryptographic algorithms, perform a Diffie-Hellman key exchange, and establish a shared secret. Random values (nonces) are also exchanged to add entropy.
The second phase, IKE_AUTH, authenticates both peers using their identities and the cryptographic material derived from IKE_SA_INIT. This phase also sets up the first IPSec SA.
IKEv2 supports dynamic rekeying using a CREATE_CHILD_SA exchange. This allows new SAs to be negotiated with fresh key material, either for the IKE SA or the IPSec SA. The ability to rekey independently for each SA adds flexibility and long-term security.
Additionally, IKEv2 introduces INFORMATIONAL exchanges to manage control traffic. These messages handle tasks such as liveness checks, session tear-downs, and SA deletions, thereby improving session maintenance and cleanup.
IKEv2 vs IKEv1: Why Upgrade?
IKEv2 delivers multiple advantages over IKEv1:
- Stronger security: Proposal exchanges are encrypted and authenticated.
- Fewer messages: More efficient SA negotiation.
- Better DoS protection: Peer validation via cookies and controlled handshake flow.
- Enhanced cryptographic support: All proposals can be sent in a single transform, unlike IKEv1’s one-transform-per-policy limitation.
- Support for modern encryption and hashing algorithms: With Suite B compliance, it’s better suited for government and enterprise networks.
Ultimately, IKEv2 is the current best-practice standard for establishing IPSec tunnels. It provides secure negotiation, robust rekeying, and the flexibility needed to meet the demands of modern networking.
Deep Dive: The IKEv2 Exchange Process
At the heart of secure VPN establishment lies the IKEv2 Exchange, a robust, efficient, and secure process for negotiating cryptographic parameters and establishing IPSec Security Associations (SAs). IKEv2 dramatically improves upon its predecessor (IKEv1) by reducing message overhead, strengthening authentication, and improving support for NAT and DoS protection.
Overview of IKEv2 Exchange Flow
The IKEv2 exchange begins with the IKE_SA_INIT and IKE_AUTH message pairs. These four messages (usually two in each exchange) handle the negotiation of security parameters and peer authentication, while also establishing the initial IPSec tunnel (Child SA).
- IKE_SA_INIT (2 messages): Exchanges cryptographic algorithms, performs a Diffie-Hellman key exchange, and sets up initial security attributes.
- IKE_AUTH (2 messages): Authenticates peers, verifies identities, and establishes the first IPSec Security Association (Child SA).
- The result: a protected data path and a secure tunnel for encrypted traffic.
IKE_SA_INIT Explained
The initiator begins the exchange by proposing a list of supported cryptographic algorithms and sending a Diffie-Hellman public key. It also includes a randomly generated nonce (a value used once) to ensure uniqueness in the key generation. This initial packet contains:
- A list of transforms (algorithm groupings)
- Security Parameter Indexes (SPIs)
- Version numbers and feature flags
The responder then selects a compatible set of algorithms and replies with its public key and nonce.
IKE_SA_INIT performs several key functions:
- Negotiates transforms for encryption, integrity, PRF, and DH groups
- Establishes the IKEv2 SA
- Performs NAT detection (via NAT_DETECTION payloads if required)
IKEv2’s transforms can include combined-mode ciphers such as AES-GCM or AES-CCM, which provide both encryption and integrity. A proposal must only contain algorithms of the same mode. Integrity and encryption can coexist, but they cannot be mixed with combined-mode algorithms in the same proposal.
IKEv2 also introduces PRF negotiation, which is mandatory in IKEv2 but not in IPSec. PRFs are used for key generation, and their inclusion distinguishes IKEv2 Security Associations (SAs) from IPSec SAs.
Each IKE session is uniquely identified by a 64-bit SPI, and the negotiated secret is computed from both peers’ Diffie-Hellman keys and nonces.
Peer Authentication with IKE_AUTH
Following successful IKE_SA_INIT, IKE_AUTH is responsible for:
- Authenticating each peer
- Exchanging digital certificates or pre-shared keys
- Establishing the first Child SA for IPSec data protection
IKEv2 supports RSA and ECDSA signatures for authentication, and optionally supports HTTP_CERT_LOOKUP, allowing peers to send only a hash of their certificate and a URL for retrieval. Though not universally supported, this method saves bandwidth and improves privacy.
Identity Exchange and Verification
IKEv2 allows a variety of identity formats, including:
- IP addresses (ID_IPV4_ADDR / ID_IPV6_ADDR)
- Fully qualified domain names (ID_FQDN)
- Email addresses (ID_RFC822_ADDR)
- Distinguished Names in DER format (ID_DER_ASN1_DN or ID_DER_ASN1_GN)
- Vendor-specific octet strings (ID_KEY_ID)
Unless EAP is used, the initiator must always reveal its identity first. EAP is often used in remote access VPNs with a RADIUS server and allows dynamic authentication via username/password or smart card. On Cisco IOS, EAP identity lookup is supported with the query-identity command.
Traffic Selectors and Encryption Scope
Traffic selectors define what traffic should be encrypted. They include:
- Source/destination IP addresses (IPv4/IPv6)
- Protocol ID
- Port ranges
These are used to configure the Child SA. If GRE is used for tunneling, the outer transport address is used in the selector.
NAT Detection and NAT Traversal
IKEv2 supports NAT-T (NAT Traversal) and Dead Peer Detection (DPD) natively. It detects NAT devices by hashing the IP/port pairs and comparing them between peers. If NAT is detected, traffic switches from UDP 500 to UDP 4500.
ESP traffic over UDP includes a zero-value checksum, while IKE traffic uses a 4-byte non-ESP marker (all zeros) to distinguish it from ESP traffic.
For keepalive functionality across NAT devices, Cisco IOS supports NAT-T keepalives and recommends DPD to maintain NAT mapping. If this is required, IKEv2 can send periodic blank INFORMATIONAL payloads to refresh the NAT binding.
To disable automatic NAT detection and avoid floating to UDP 4500, use:
no crypto ipsec nat-transparency udp-encapsulation
Message Reliability and Optimization
IKEv2 improves reliability by requiring that every message be acknowledged. If an acknowledgment is not received, the sender must retransmit the message. This is more reliable than IKEv1, where retransmissions were not strictly enforced.
IKEv2 further simplifies IPSec SA creation. In IKEv1, three messages (Quick Mode) were required for every additional Child SA. In contrast, IKEv2 can establish new SAs using just two messages via a CREATE_CHILD_SA exchange.
Visual Comparison: IKEv1 vs. IKEv2 Message Flow
The below graphic shows just how much simpler IKEv2 is. In IKEv1, establishing the tunnel required 9–10 message steps. IKEv2 compresses this to 4 primary steps, plus optional CREATE_CHILD_SA steps for additional IPSec SAs.

If additional IPSec SAs were required in IKEv1, a minimum of three messages would be used by Quick Mode to create these, whereas IKEv2 employs just two messages with a CREATE_CHILD_SA exchange.
IKEv2 streamlines VPN tunnel creation through a more efficient and secure exchange process. It uses fewer messages, supports modern cryptography, simplifies rekeying, and enhances peer authentication through EAP and digital signatures. It also brings better NAT support and more reliable messaging, making it the standard for enterprise-grade IPSec VPN deployments.
Additional Features and Enhancements in IKEv2
While the core of IKEv2 lies in its efficient negotiation of Security Associations and authentication, the protocol also includes a wealth of features that enhance security, flexibility, and manageability in modern VPN deployments.
Anti-Denial of Service
IKEv2 includes a stateless cookie mechanism designed to protect the VPN gateway during a Denial of Service (DoS) attack. When under stress, the VPN server can issue a zero-state cookie in response to an IKE_SA_INIT message, ensuring that only clients that respond with the correct cookie proceed with negotiation, effectively filtering out spoofed or malicious traffic
Robust Authentication Methods
IKEv2 supports multiple authentication methods, providing flexibility across deployment scenarios:
- Pre-Shared Key (PSK)
- Digital Signature (RSA-sig)
- Extensible Authentication Protocol (EAP): Widely used in enterprise environments, especially with backend RADIUS servers.
- Elliptic Curve Digital Signature Algorithm (RSA-ECDSA): Allowed under Suite B profiles for IPSec, offering greater efficiency with smaller key sizes.
Each peer can choose its preferred authentication method, and IKEv2 accommodates differing authentication mechanisms between peers.
High Availability and Gateway Redirection
IKEv2 supports high availability by allowing clients to be redirected to alternate VPN gateways. This is essential in enterprise environments with multiple headends and helps reduce downtime and session drops during maintenance or failover.
Advanced Traffic Selectors
One of the powerful features of IKEv2 is the ability to define complex traffic selectors. Administrators can specify:
- Source and destination IP address ranges
- IP protocol types
- Source/destination port ranges
This level of granularity enables organizations to create highly specific VPN policies tailored to different applications or departments.
Flexible Identity Support
IKEv2 allows peers to use multiple identities even when sharing the same IP address and port pair. This enables multiple VPN sessions to be established concurrently using different authentication mechanisms or policies, greatly enhancing scalability and deployment flexibility.
Built-in NAT Support
IKEv2 includes NAT-awareness in the core specification. It supports both Dead Peer Detection (DPD) and NAT keepalives, enabling the maintenance of NAT translation tables even when traffic is idle. These features ensure long-lived sessions can persist across NAT devices without dropping unexpectedly.
Configuration Payloads
IKEv2 natively supports the exchange of configuration data during tunnel establishment. This can include DNS settings, internal IP address assignment, or domain name details, making it a natural fit for dynamic endpoint deployments.
Identity Matching Enhancements
Unlike IKEv1, IKEv2 removes the rigid requirement of assigning unique identities per pre-shared key. With IKEv2, separate user groups can use the same IP address while maintaining distinct identities through their credentials, enabling cleaner and more scalable access control.
Reliable Message Handling
Every IKEv2 message is part of a pair and must be acknowledged. This results in more reliable session management and simplifies retransmission logic, reducing the chance of miscommunication or stale tunnels.
Reduction of Cryptographic Exchange Bloat
IKEv1 sent separate transform payloads for each supported algorithm set. IKEv2 streamlines this by bundling all supported cryptographic ciphers into a single transform (or two, if using combined mode). This significantly reduces bandwidth consumption and simplifies negotiation and rekeying.
Combined Mode Ciphers
IKEv2 introduced combined mode cipher support, enabling a single algorithm to provide both encryption and integrity. Algorithms like AES-GCM and AES-CCM fall into this category. This advancement reduces processing overhead and accelerates throughput on modern hardware.
Continuous Channel Mode
Another IKEv2 innovation is continuous channel mode, where a newly established IKE SA inherits the valid child SAs of a previously existing SA. This reduces downtime and overhead when reestablishing sessions, helping to maintain continuity in long-lived VPN connections.
Dual Stack Support
Cisco IOS supports dual-stack (IPv4 and IPv6) on IKEv2 gateways, particularly with AnyConnect clients. The transport layer must be IPv4 and GRE-encapsulated, but both IPv4 and IPv6 addresses can be obtained dynamically and used with the correct traffic selectors
Hashing for Integrity
IKEv2 uses hashing to ensure message integrity. Supported algorithms include:
- MD5: 64-bit hash, now mostly deprecated due to vulnerabilities
- SHA: 80-bit hash (and higher variants like SHA-256), offering stronger integrity guarantees
These one-way functions ensure that messages haven’t been tampered with in transit.
Conclusion
IKEv2 is far more than just a negotiation framework; it’s a powerful, adaptable, and modern standard for secure communications. With features like robust authentication, traffic selectors, NAT-T support, and flexible identity handling, IKEv2 is designed to meet the demands of modern enterprise and service provider networks alike.