Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Diffie-Hellman Groups

Direct answer

Diffie-Hellman groups set the strength of IPsec key exchange. Use group 19, 20 or 21 (elliptic curve) or at least group 14 (2048-bit MODP); groups 1, 2 and 5 are obsolete.

When to use this

Use this when choosing Diffie-Hellman groups for IPsec.

First 30 seconds

1. DH groups set key exchange strength.

2. Use 19/20 (ECP-256/384), 21, 31 (Curve25519), or 14+ MODP (2048-bit).

3. Avoid 1, 2, 5.

4. Same group for PFS.

5. Post-quantum hybrids emerging (RFC 9370).

Operational verification

DH group → shared secret → keys

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • DH groups 1, 2 and 5 still allowed (768–1536-bit MODP — too weak).
  • Phase 1 and PFS groups differing between peers.
  • Choosing very large MODP groups (group 16+) on low-end hardware, causing slow rekeys.
  • Prefer ECP groups 19/20 or group 21; group 14 (2048-bit) is the minimum MODP.
Platform / version applicability
Network security
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformNetwork security
Scope / prerequisiteUse this when choosing Diffie-Hellman groups for IPsec.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Use groups 19, 20, 21 or at least 14.
  • Groups 1, 2, 5 are obsolete.
  • Both peers must match.
Key checks
  • IKE proposal DH group — 14, 19, 20, 21, 31
  • show crypto ikev2 sa detailed | include DH — negotiated group
  • swanctl --list-sas — ECP/MODP group
ReferenceWhy it matters1 section · depth on demand

Groups

GroupTypeStatus
1, 2, 5768–1536-bit MODPBroken / do not use
142048-bit MODPMinimum acceptable
15, 163072/4096-bit MODPStrong but slow
19, 20, 21256/384/521-bit ECPRecommended

Use the same DH group for PFS in Phase 2.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Diffie-Hellman (DH) groups define the mathematical group used for key exchange in IKE and PFS. Stronger groups protect against an attacker who records traffic and tries to derive the keys later.

GroupTypeStatus
1, 2, 5MODP 768/1024/1536Weak — remove
14MODP 2048Minimum acceptable
15, 16MODP 3072/4096Strong, slower
19, 20, 21ECP 256/384/521Recommended
31Curve25519Recommended where supported

Both peers must agree on the group in IKE and, if PFS is used, in phase 2/child SAs. DH group mismatch in PFS settings is a classic reason a tunnel establishes phase 1 but fails at rekey.

ReferenceConfiguration & state1 section · depth on demand

Configuration examples

# strongSwan
ike=aes256gcm16-prfsha384-ecp384
# Cisco IOS XE
crypto ikev2 proposal P1
 group 20 19

Documented example, not captured output. Group 31 (Curve25519) is supported on many newer platforms; check both peers before using it.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docNetwork security current

Authoritative/upstream documentation reviewed for bounded claims in IPsec → Diffie-Hellman Groups. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc4301 · confidence 94%
Confirmation

Confirm action

Continue?