The IKE SA & the child SA

Two negotiations: IKE and IPsec

Lesson 2 of 20 · 11 min · Module 1: A private path over a public network

Before a single packet is encrypted, the two gateways hold a short conversation to agree how. That conversation has two parts, and each produces its own set of keys.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Tell the IKE SA from the IPsec (child) SA
  • Read the three parts of an IKE proposal
  • Write the two proposals a tunnel needs

The idea

IKE (Internet Key Exchange) first builds a protected channel between the gateways, the IKE SA. Inside it, the gateways agree the IPsec SA (in IKEv2 called the child SA), which is what actually encrypts your traffic. Each has its own proposal: the list of algorithms a gateway offers.

ike proposal aes128 sha256 dh19
ipsec proposal aes128 sha256

01The IKE proposal has three parts

An encryption algorithm (aes256) keeps the negotiation private. An integrity algorithm (sha256) detects tampering. A Diffie-Hellman group (dh14) lets the two gateways compute a shared secret over the open internet without ever sending it. A higher group number does not always mean stronger, but groups 14 and above are the ones in use today.

02The IPsec proposal protects the data

The child SA uses ESP (Encapsulating Security Payload) to encrypt and authenticate every packet in the tunnel. Its proposal names an encryption and an integrity algorithm. The two proposals are independent: the IKE SA and the child SA may use different algorithms.

03The two proposals on real devices

Older documentation calls them phase 1 and phase 2; IKEv2 calls them the IKE SA and the child SA.

# FortiGate
config vpn ipsec phase1-interface
    edit "to-branch"
        set ike-version 2
        set proposal aes256-sha256
        set dhgrp 14
    next
end
config vpn ipsec phase2-interface
    edit "to-branch-p2"
        set proposal aes256-sha256
    next
end

# Huawei USG
ike proposal 10
 encryption-algorithm aes-256
 integrity-algorithm hmac-sha2-256
 dh group14
ipsec proposal prop1
 esp encryption-algorithm aes-256
 esp authentication-algorithm sha2-256

# Cisco IOS
crypto ikev2 proposal PROP1
 encryption aes-cbc-256
 integrity sha256
 group 14
crypto ipsec transform-set TS1 esp-aes 256 esp-sha256-hmac

Your turn

The peer, the key and the selector are in place, but the gateway has nothing to offer. Add an ike proposal and an ipsec proposal that match what the branch gateway accepts. Its settings are in the panel above the editor.

What the checks look for

  • The IKE SA is established with the agreed algorithms
  • The child SA is established with the agreed algorithms
  • The tunnel carries the traffic between the offices
  • Nothing weak is offered
Try it in the editor →

Take this with you

A tunnel is two agreements: the IKE SA between the gateways, and the child SA that carries the data. Each has its own proposal.

Go a little further

Remove the ipsec proposal line again and run the lab, to see how far the negotiation gets with only the IKE proposal.

Learn VPN & IPsec Foundations for free

20 short lessons with real code and instant checks.

See the whole course →