Understand IPsec IKEv1 Protocol (2024)

    Introduction

    This document describes the Internet Key Exchange (IKEv1) protocol process for a Virtual Private Network (VPN) establishment.

    Prerequisites

    Requirements

    Cisco recommends that you have knowledge of basic security concepts:

    • Authentication
    • Confidentiality
    • Integrity
    • IPsec

    Components Used

    This document is not restricted to specific software and hardware versions.

    The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.

    Background Information

    Internet Key Exchange (IKEv1) protocol process for a Virtual Private Network (VPN) establishment is important to understand the packet exchange for simpler troubleshooting any kind ofInternet Protocol Security (IPsec) issue with IKEv1.

    IPsec

    IPsec is a suite of protocols that provides security to Internet communications at the IP layer. The most common current use of IPsec is to provide a Virtual Private Network (VPN), either between two locations (gateway-to-gateway) or between a remote user and an enterprise network (host-to-gateway).

    IKE Protocol

    IPsec uses the IKE protocol to negotiate and establish secured site-to-site or remote access virtual private network (VPN) tunnels. IKE protocol is also called the Internet Security Association and Key Management Protocol (ISAKMP) (Only in Cisco).

    There are two versions of IKE:

    • IKEv1: Defined in RFC 2409, The Internet Key Exchange
    • IKE version 2 (IKEv2): Defined in RFC 4306, Internet Key Exchange (IKEv2) Protocol

    IKE Phases

    ISAKMP separates negotiation into two phases:

    • Phase 1: The two ISAKMP peers establish a secure and authenticated tunnel, which protects ISAKMP negotiation messages. This tunnel is known as the ISAKMP SA. There are two modes defined by ISAKMP: Main Mode (MM) and Aggressive Mode.
    • Phase 2: It negotiates key materials and algorithms for the encryption (SAs) of the data to be transferred over the IPsec tunnel. This phase is called Quick Mode.

    To materialize all the abstract concepts, the Phase 1 tunnel is the Parent tunnel and phase 2 is a sub tunnel. This image illustrates the two phases as tunnels:

    Understand IPsec IKEv1 Protocol (1)

    Note: Phase 1 (ISAKMP) Tunnel protects the Control Plante VPN traffic between the two gateways. Control Plane traffic can be Negotiation packets, information packages, DPD, keepalives, rekey, and so on. ISAKMP negotiation uses the UDP 500 and 4500 ports to establish a secure channel.

    Note: Phase 2 (IPsec) Tunnel protects the Data Plane traffic that passes through the VPN between the two gateways. The algorithms used to protect the data are configured in Phase 2 and are independent of those specified in Phase 1.
    The protocol used to encapsulate and encrypt these packets is the Encapsulation Security Payload (ESP).

    IKE Modes (Phase 1)

    Main Mode

    An IKE session begins when the initiator sends a proposal or proposal to the responder. The first exchange between nodes establishes the basic security policy; the initiator proposes the encryption and authentication algorithms to be used. The responder chooses the appropriate proposal (assume a proposal is chosen) and sends it to the initiator. The next exchange passes Diffie-Hellman public keys and other data. All further negotiation is encrypted within the IKE SA. The third exchange authenticates the ISAKMP session. Once the IKE SA is established, IPSec negotiation (Quick Mode) begins.

    Aggressive Mode

    Aggressive Mode squeezes the IKE SA negotiation into three packets, with all data required for the SA passed by the initiator. The responder sends the proposal, key material, and ID, and authenticates the session in the next packet. The initiator replies and authenticates the session. Negotiation is quicker, and the initiator and responder ID pass in the clear.

    IPsec Mode (Phase 2)

    Quick Mode

    IPSec negotiation, or Quick Mode, is similar to an Aggressive Mode IKE negotiation, except negotiation, must be protected within an IKE SA. Quick Mode negotiates the SA for the data encryption and manages the key exchange for that IPSec SA.

    IKE Glossary

    • A security association (SA) is the establishment of shared security attributes between two network entities to support secure communication. An SA includes attributes such as cryptographic algorithm and mode; traffic encryption key; and parameters for the network data to be passed over the connection.
    • The vendor IDs (VID) are processed to determine whether the peer supports the NAT-Traversal, Dead Peer Detection feature, Fragmentation, and so on.
    • Nonce: a randomly generated number that the initiator sends. This nonce is hashed along with the other items with the agreed key used and is sent back. The initiator checks the cookie and the nonce and rejects any messages which do not have the right nonce. This helps prevent replay since no third party can predict what the randomly generated nonce is.
    • Key-exchange (KE) information for the Diffie-Hellman (DH) secure key-exchange process.
    • Identity Initiator/responder (IDi/IDr) is used to send out authentication information to the peer. This information is transmitted under the protection of the common shared secret.
    • Diffie–Hellman (DH) key exchange is a method of securely cryptographic algorithms exchange over a public channel.
    • The IPSec shared key can be derived with the DH used again to ensure Perfect Forward Secrecy (PFS) or the original DH exchange refreshed to the shared secret derived previously.

    Main Mode Packet Exchange

    Each ISAKMP packet contains payload information for the tunnel establishment. The IKE glossary explains the IKE abbreviations as part of the payload content for the packet exchange on Main Mode as shown in this image.

    Understand IPsec IKEv1 Protocol (2)

    Main Mode 1 (MM1)

    To set the terms of the ISAKMP negotiations, you create an ISAKMP policy, which includes:

    • An authentication method, to ensure the identity of the peers.
    • An encryption method, to protect the data and ensure privacy.
    • A Hashed Message Authentication Codes (HMAC) method to ensure the identity of the sender, and to ensure that the message has not been modified in transit.
    • A Diffie-Hellman group to determine the strength of the encryption-key-determination algorithm. The security appliance uses this algorithm to derive the encryption and hash keys.
    • A limit to the time the security appliance uses an encryption key before it gets replaced.

    The first packet is sent by the Initiator of the IKE negotiation as shown in the image:

    Understand IPsec IKEv1 Protocol (3)

    Note: The Main Mode 1 is the first packet of the IKE negotiation. Therefore, the Initiator SPI is set to a random value while Responder SPI is set to 0. In the second packet (MM2) the Responder SPI must be replied to with a new value and the entire negotiation maintains the same SPIs values.

    If the MM1 is captured and a Wireshark network protocol analyzer is used, the SPI value is within the Internet Security Association and Key Management Protocol content as shown in the image:

    Understand IPsec IKEv1 Protocol (4)

    Note: In the case, the MM1 packet gets lost in the path or there is no MM2 reply, the IKE negotiation keeps the MM1 retransmissions until the maximum number of retransmissions is reached. At this point, the Initiator keeps the same SPI until the next negotiation is triggered again.

    Tip: Initiator and Responder SPIs identification is very helpful to identify multiple negotiations for the same VPN and narrow down some negotiation issues.

    Identify Two Simultaneous Negotiations

    On the Cisco IOS® XE platforms, the debugs can be filtered per tunnel with a conditional for the remote IP address configured. However, the simultaneous negotiations are displayed on the logs, and there is no way to filter them. It is needed to do it manually. As previously mentioned, the whole negotiation keeps the same SPI values for Initiator and responder. In case a packet is received from the same peer IP address but the SPI does not match the previous value tracked before the negotiation reaches the maximum number of retransmission, it is another negotiation for the same peer as shown in the image:

    Understand IPsec IKEv1 Protocol (5)

    Note: The example shows simultaneous negotiation for the first packet in the negotiation (MM1). However, this can occur at whatever negotiation point. All the subsequent packets must include a value different from 0 on responder SPI.

    Main Mode 2 (MM2)

    In the Main Mode 2 packet, the responder sends the selected policy for the proposals matched, and the responder SPI is set to a random value. The entire negotiation maintains the same SPIs values. The MM2 replies to MM1 and the SPI responder is set to a different value from 0 as shown in the image:

    Understand IPsec IKEv1 Protocol (6)

    If the MM2 is captured and a Wireshark network protocol analyzer is used, the Initiator SPI and Responder SPI values are within the Internet Security Association and Key Management Protocol content as shown in the image:

    Understand IPsec IKEv1 Protocol (7)

    Main Mode 3 and 4 (MM3-MM4)

    The MM3 and MM4 packets are still unencrypted and unauthenticated and the Secret key exchange takes place. MM3 and MM4 are shown in the image:

    Understand IPsec IKEv1 Protocol (8)

    Main Mode 5 and 6 (MM5-MM6)

    The MM5 and MM6 packets are already encrypted but still unauthenticated. On these packets, the authentication takes place as shown in the image:

    Understand IPsec IKEv1 Protocol (9)

    Quick Mode (QM1, QM2, and QM3)

    Quick mode occurs after the Main monde and the IKE has established the secure tunnel in phase 1. Quick Mode negotiates the shared IPSec policy, for the IPSec security algorithms and manages the key exchange for the IPSec SA establishment. The nonces are used to generate new shared secret key material and prevent replay attacks from bogus SAs generated.

    Three packets are exchanged in this phase as shown in the image:

    Understand IPsec IKEv1 Protocol (10)

    Aggressive Mode Packet Exchange

    The Aggressive Mode squeezes the IKE SA negotiation into three packets, with all data required for the SA passed by the initiator.

    • The responder sends the proposal, key material, and ID, and authenticates the session in the next packet.
    • The initiator replies and authenticates the session.
    • Negotiation is quicker, and the initiator and responder ID pass in the clear.

    The image shows the payload content for the three packets exchanged on Aggressive mode:

    Understand IPsec IKEv1 Protocol (11)

    Main Mode vs Aggressive Mode

    Compared to the Main Mode, Aggressive Mode comes down to three packages:

    • AM 1 absorbs MM1 and MM3.
    • AM 2 absorbs MM2, MM4, and part of the MM6. This is where the vulnerability of Aggressive Mode comes from. The AM 2 makes up the IDr and Authentication unencrypted. Unlike the Main Mode, this information is encrypted.
    • AM 3 provides the IDi and the Authentication. Those values are encrypted.

    Understand IPsec IKEv1 Protocol (12)

    IKEv2 vs IKEv1 Packet Exchange

    In the IKEv2 negotiation, fewer messages are exchanged to establish a tunnel. IKEv2 uses four messages; IKEv1 uses either six messages (in the main mode) or three messages (in aggressive mode).

    The IKEv2 message types are defined as Request and Response pairs. The image shows the packets comparison and payload content of IKEv2 versus IKEv1:

    Understand IPsec IKEv1 Protocol (13)

    Note: This document does not delve deeper into the IKEv2 Packet exchange. For more references, navigate to IKEv2 Packet Exchange and Protocol Level Debugging.

    Policy-Based vs Route-based

    Policy-Based VPN

    As the name states, apolicy-based VPN is an IPsec VPN tunnel with a policy action for the transit traffic that meets the policy's match criteria. In the case of Cisco devices, an Access List (ACL) is configured and attached to a crypto map to specify the traffic to be redirected to the VPN and encrypted.

    The traffic selectors are the subnets or hosts specified on the policy as shown in the image:

    Understand IPsec IKEv1 Protocol (14)

    Route-Based VPN

    A Policy is not needed. The traffic is redirected toward the tunnels with routes, and it supports dynamic routing over the tunnel interface. The traffic selectors (traffic encrypted through the VPN) are from 0.0.0.0. to 0.0.0.0 by default as shown in the image:

    Understand IPsec IKEv1 Protocol (15)

    Note: Due to the Traffic selectors are 0.0.0.0, any host or subnet is included within. Therefore, only one SA is created. There is an exception for Dynamic tunnel. This document does not describe dynamic tunnels.

    The Policy and Route-based VPN can be materialized as shown in the image:

    Understand IPsec IKEv1 Protocol (16)

    Note: Unlike Route-based VPN with only one SA created, the Policy-based VPN can create multiples SA. As an ACL is configured, each statement on the ACL (if they are different between them) creates a sub-tunnel.

    Common Issues for Traffic Does Not Receive through the VPN

    ISP Blocks UDP 500/4500

    It is a very common issue that the Internet Services Provider (ISP) blocks the UDP 500/4500 ports. For an IPsec tunnel establishment, two different ISPs can be engaged. One of them can block the ports, and the other allows them.

    The image shows the two scenarios where an ISP can block the UDP 500/4500 ports in only one direction:

    Understand IPsec IKEv1 Protocol (17)

    Note: Port UDP 500 is used by the Internet key exchange (IKE) for the establishment of secure VPN tunnels. UDP 4500 is used when NAT is present in one VPN endpoint.

    Note: When the ISP Blocks UDP 500/4500, the IPsec tunnel establishment is affected and it does not get up.

    ISP Blocks ESP

    Another very common issue on IPsec tunnels is the ISP blocks the ESP traffic; however, it allows the UDP 500/4500 ports. For example, the UDP 500/4500 ports are allowed in bidirectional ways. Therefore, the tunnel is successfully established, but the ESP packets are blocked by the ISP or ISPs in both directions. This causes the encrypted traffic through the VPN to fail as shown in the image:

    Understand IPsec IKEv1 Protocol (18)

    Note: When the ISP Blocks ESP packets, the IPsec tunnel establishment is successful, but the traffic encrypted is affected. It can be reflected with the VPN up, but the traffic does not work over it.

    Tip: The scenario where the ESP traffic is blocked only in one direction can be present as well. The symptoms are the same, but it can be easily found with the tunnel statistics information, encapsulation, decapsulation counters, or RX and TX counters.

    Related Information

    Understand IPsec IKEv1 Protocol (2024)

    FAQs

    What is IPsec IKEv1? ›

    In computing, Internet Key Exchange (IKE, versioned as IKEv1 and IKEv2) is the protocol used to set up a security association (SA) in the IPsec protocol suite. IKE builds upon the Oakley protocol and ISAKMP.

    What are the three phases of IPsec IKEv1 exchange? ›

    IKEv1 goes through two phases to establish SAs. In phase 1, two peers negotiate and establish a secure tunnel, which is an IKE SA. In phase 2, the two peers establish a pair of IPsec SAs for secure data transmission through the secure tunnel established in phase 1.

    What is the IKE protocol for IPsec? ›

    Internet Key Exchange (IKE) protocol— IPsec supports automated generation and negotiation of keys and security associations using the IKE protocol. Using IKE to negotiate VPNs between two endpoints provides more security than the manual key exchange.

    What is the main difference between IKEv1 and IKEv2? ›

    What are differences between IKEv1 and IKEv2? (IKEv1 vs. IKEv2)
    IKEv1IKEv2 (SIMPLE and RELIABLE!)
    Exchange modes: Main mode Aggressive modeOnly one exchange procedure is defined. Exchange modes were obsoleted.
    Exchanged messages to establish VPN. Main mode: 9 messages Aggressive mode: 6 messagesOnly 4 messages.
    15 more rows

    Is IKEv1 obsolete? ›

    In order to guarantee the safety of Liferay Cloud customers, we're deprecating the IKEv1 protocol and recommending the use of IKEv2. IKEv2 has now seen wide deployment and provides a full replacement for all IKEv1 functionality.

    Is IKEv1 still secure? ›

    IKEv1 was designed in the late 1990s, so it is unlikely that most IKE protocols are vulnerable to this attack, however, it is known that some legacy systems enable this version of IKE by default. Additionally, there are a handful of Cisco devices/versions that are vulnerable to CVE-2016-6415.

    What is Phase 1 and Phase 2 in IKEv1? ›

    Phase 1 establishes an IKE Security Associations (SA) these IKE SAs are then used to securely negotiate the IPSec SAs (Phase 2). Data is transmitted securely using the IPSec SAs. Phase 1 = "show crypto isakmp sa" or "show crypto ikev1 sa" or "show crypto ikev2 sa" Phase 2 = "show crypto ipsec sa"

    What are the 3 main protocols that IPsec uses? ›

    Some IPSec protocols are given below.
    • Authentication header (AH)
    • Encapsulating security payload (ESP)
    • Internet key exchange (IKE)

    How does IPsec work step by step? ›

    This procedure involves two steps: Phase 1 establishes the IKE SA tunnel, a two-way management tunnel for key exchange. Once the communication is established, IPSEC SA channels for secure data transfer are established in phase 2.

    What is the difference between IKE and IPsec VPN? ›

    The IKE protocol uses User Datagram Protocol (UDP) packets to create an SA, generally needing four to six packets with two to three messages. An IPsec stack intercepts relevant IP packets, encrypting and decrypting them as needed.

    What is the primary function of the IKE protocol used with IPsec? ›

    The Internet Key Exchange (IKE) protocol is used with IPsec to create a security association between communicating partners. It controls the negotiation of encryption methods, identifies how keys are exchanged, and sets up other parameters that control communications.

    What is IKE Phase 1 protocol? ›

    IKE Modes (Phase 1)

    The responder chooses the appropriate proposal (assume a proposal is chosen) and sends it to the initiator. The next exchange passes Diffie-Hellman public keys and other data. All further negotiation is encrypted within the IKE SA. The third exchange authenticates the ISAKMP session.

    What is the main advantage of IKEv2 over IKEv1? ›

    IKEv2 provides the following benefits over IKEv1: IKEv2 mode is considered to be more secure,reliable and faster. In IKEv2 Tunnel endpoints exchange fewer messages to establish a tunnel. IKEv2 uses four messages; IKEv1 uses either six messages (in the main mode) or three messages (in aggressive mode).

    What port does IKEv1 use? ›

    Comparison of IKEv2 and IKEv1
    FeatureIKEv2IKEv1
    IKE preshared keysike/ikev2.presharedsecret/ike.preshared
    NAT portUDP port 4500UDP port 4500
    PortUDP port 500UDP port 500
    Rights profileNetwork IPsec ManagementNetwork IPsec Management
    13 more rows

    What are the different modes of IKEv1? ›

    IKEv1 SA negotiation consists of two phases. IKEv1 phase 1 negotiation aims to establish the IKE SA. This process supports the main mode and aggressive mode. Main mode uses six ISAKMP messages to establish the IKE SA, but aggressive mode uses only three.

    What is IPsec in 5G? ›

    IPsec (Internet Protocol Security) enhances the security of 5G networks by encrypting and authenticating IP packets. It ensures confidentiality by encrypting data, integrity by verifying data integrity, and authentication by verifying the identity of communicating parties.

    Should I use IKEv2 or IPsec? ›

    So in the IKEv2 vs. IPsec dispute, there is no winner. These technologies are the most efficient when combined. IKEv2 handles your data security, while IPsec is responsible for its movement through the encrypted tunnel.

    What is IKE Phase 1? ›

    IKE Modes (Phase 1)

    The responder chooses the appropriate proposal (assume a proposal is chosen) and sends it to the initiator. The next exchange passes Diffie-Hellman public keys and other data. All further negotiation is encrypted within the IKE SA. The third exchange authenticates the ISAKMP session.

    Top Articles
    Hades
    How to Lose Weight Running: Essential Guide to Running for Weight Loss
    Rosy Boa Snake — Turtle Bay
    Calvert Er Wait Time
    Best Team In 2K23 Myteam
    Belle Meade Barbershop | Uncle Classic Barbershop | Nashville Barbers
    Kokichi's Day At The Zoo
    Bin Stores in Wisconsin
    Mcfarland Usa 123Movies
    Blanchard St Denis Funeral Home Obituaries
    The 10 Best Restaurants In Freiburg Germany
    Boomerang Media Group: Quality Media Solutions
    Apex Rank Leaderboard
    Crossed Eyes (Strabismus): Symptoms, Causes, and Diagnosis
    Power Outage Map Albany Ny
    How to watch free movies online
    C-Date im Test 2023 – Kosten, Erfahrungen & Funktionsweise
    Med First James City
    104 Whiley Road Lancaster Ohio
    ᐅ Bosch Aero Twin A 863 S Scheibenwischer
    Overton Funeral Home Waterloo Iowa
    Fdny Business
    How To Cancel Goodnotes Subscription
    Northeastern Nupath
    SF bay area cars & trucks "chevrolet 50" - craigslist
    CDL Rostermania 2023-2024 | News, Rumors & Every Confirmed Roster
    Mccain Agportal
    Azpeople View Paycheck/W2
    Project, Time & Expense Tracking Software for Business
    Chase Bank Pensacola Fl
    Hdmovie2 Sbs
    Olivia Maeday
    Pensacola Tattoo Studio 2 Reviews
    27 Modern Dining Room Ideas You'll Want to Try ASAP
    13301 South Orange Blossom Trail
    Cylinder Head Bolt Torque Values
    Jailfunds Send Message
    Hwy 57 Nursery Michie Tn
    Loopnet Properties For Sale
    Rogold Extension
    Ridge Culver Wegmans Pharmacy
    Sitting Human Silhouette Demonologist
    Green Bay Crime Reports Police Fire And Rescue
    Tal 3L Zeus Replacement Lid
    Game8 Silver Wolf
    Td Ameritrade Learning Center
    Electric Toothbrush Feature Crossword
    Devon Lannigan Obituary
    Arcane Bloodline Pathfinder
    F9 2385
    Sml Wikia
    Salem witch trials - Hysteria, Accusations, Executions
    Latest Posts
    Article information

    Author: Nicola Considine CPA

    Last Updated:

    Views: 6088

    Rating: 4.9 / 5 (69 voted)

    Reviews: 84% of readers found this page helpful

    Author information

    Name: Nicola Considine CPA

    Birthday: 1993-02-26

    Address: 3809 Clinton Inlet, East Aleisha, UT 46318-2392

    Phone: +2681424145499

    Job: Government Technician

    Hobby: Calligraphy, Lego building, Worldbuilding, Shooting, Bird watching, Shopping, Cooking

    Introduction: My name is Nicola Considine CPA, I am a determined, witty, powerful, brainy, open, smiling, proud person who loves writing and wants to share my knowledge and understanding with you.