Octet

What is Diffie-Hellman used for in IPsec, and which groups should you use?

Show the answer

Say this first

Diffie-Hellman lets the two peers compute the same secret over an untrusted network without ever sending it, and the IKE keys are derived from that secret. The group sets the math and the strength. Groups 1, 2 and 5 (768, 1024 and 1536-bit MODP) are too weak. Group 14 (2048-bit MODP) is the minimum; the elliptic-curve groups 19 (256-bit) and 20 (384-bit) give better strength for less CPU. Both peers must agree on the group.

Go deeper

GroupTypeUse
1, 2, 5768, 1024, 1536-bit MODPdo not use
142048-bit MODPacceptable minimum
15, 163072, 4096-bit MODPstrong but slow
19256-bit ECP (NIST P-256)recommended
20384-bit ECP (NIST P-384)recommended, typical for high-assurance policies
21521-bit ECPstrong
242048-bit MODP with 256-bit subgroupdeprecated

Points to make

  • DH alone gives no authentication. The PSK or certificate check in IKE stops a man in the middle.
  • DH runs in phase 1 and again in phase 2 if PFS is enabled.
  • The Logjam research (2015) showed that weak and widely shared DH groups are realistic targets, which is why 1024-bit groups were dropped.

Traps

  • Saying Diffie-Hellman encrypts the traffic. It only produces shared key material.