Walk me through IKE phase 1 and phase 2.
Show the answer
Say this first
Phase 1 builds an authenticated, encrypted control channel between the two gateways, the IKE SA (the ISAKMP SA in IKEv1). They agree on encryption, hash, Diffie-Hellman group, authentication method and lifetime, run Diffie-Hellman and prove their identity with a pre-shared key or a certificate. Phase 2 runs inside that channel and negotiates the IPsec SAs that carry user data: the transform set, the traffic to protect (proxy IDs), lifetimes and optional PFS. It produces a pair of one-way IPsec SAs.
Go deeper
Phase 1 parameters
Hash, Authentication method, DH Group, Lifetime, Encryption. Some people remember it as HAGLE.
Phase 2 parameters
- Protocol and algorithms: ESP cipher and integrity (the transform set)
- Mode: tunnel or transport
- Proxy IDs (traffic selectors): local and remote networks
- PFS group, if any
- Lifetime in seconds and kilobytes
Cisco IOS defaults
The ISAKMP SA lifetime defaults to 86400 seconds. IPsec SA lifetimes default to 3600 seconds and 4,608,000 kilobytes.
Where to look
show crypto isakmp sa for IKEv1 phase 1, show crypto ikev2 sa for IKEv2, and
show crypto ipsec sa for the IPsec SAs.
They will ask next
Why split it into two phases?
The expensive work, Diffie-Hellman and authentication, happens once in phase 1. Phase 2 SAs can then be created and rekeyed quickly under its protection, several of them for different traffic, without authenticating again.
Phase 1 is up and phase 2 is not. What do you compare?
What only phase 2 negotiates: transform sets, proxy IDs (the crypto ACLs must mirror), the PFS group, and mode. A debug on the responder usually names the item it rejected.
Traps
- Saying user data flows over the phase 1 SA. The IKE SA only carries IKE messages.