IPsec and VPNs over IPv6
Correct the myth that IPsec is mandatory and automatic in IPv6. Build an IKEv2 IPsec tunnel over IPv6 and explain transport vs tunnel mode. Carry both IPv4 and IPv6 inside a VPN and compare MTU overheads.
Take the quiz · pass mark 70% · 9 questions
Explanation
The myth
"IPv6 is secure because IPsec is built in / mandatory." This was never quite true and is now explicitly false. The original IPv6 node requirements recommended implementing IPsec, which people misremembered as "mandatory and always on". RFC 8504 (the current IPv6 Node Requirements) makes support of the IPsec architecture (RFC 4301) a SHOULD, not a MUST, and recognises that TLS, SSH and other mechanisms are often the right tool instead. Even where IPsec is implemented, it does nothing until an administrator configures policies and keys. IPsec in IPv6 is exactly what it is in IPv4: available, standardised, and entirely opt-in.
So IPv6 security comes from the controls in this level (first-hop, filtering, perimeter, monitoring), not from a protocol that is switched on by magic.
IPsec architecture (RFC 4301)
IPsec provides authentication, integrity and (with ESP) confidentiality at the IP layer. Components:
- ESP (Encapsulating Security Payload, protocol 50): encryption + integrity. The normal choice.
- AH (Authentication Header, protocol 51): integrity only, no encryption. Rare today; it also breaks with any address rewriting.
- IKEv2 (RFC 7296, UDP 500, and UDP 4500 for NAT traversal): negotiates the Security Associations and keys automatically. IKEv1 is deprecated (RFC 9395) — use IKEv2.
- SPD/SAD: the Security Policy Database (what to protect) and Security Association Database (the negotiated keys).
Two modes:
- Transport mode: protects the payload between two end hosts; the original IPv6 header is kept. Used host-to-host.
- Tunnel mode: encapsulates the whole original packet in a new IP header. Used for site-to-site and remote-access VPNs, and it can carry a different inner address family from the outer one.
Algorithms (RFC 8221, RFC 8247, updated by RFC 9395)
Use modern AEAD ciphers and skip the legacy ones:
- ESP encryption:
ENCR_AES_GCM_16(AES-GCM, AEAD) orENCR_CHACHA20_POLY1305. AES-CBC with a separate HMAC is still allowed but AEAD is preferred. 3DES is SHOULD NOT; DES and null-encryption for real traffic are out. - IKEv2: AES-GCM or ChaCha20-Poly1305, SHA-2 integrity/PRF, and a strong Diffie-Hellman group (e.g. group 19/20 ECP or group 31 Curve25519).
- Manual keying SHOULD NOT be used (no rekeying, no replay protection in practice); use IKEv2.
Carrying both protocols
A tunnel-mode VPN between two sites over IPv6 can carry IPv4 and IPv6 inside:
- The outer packets are IPv6 (ESP over IPv6 between the two endpoints' GUAs).
- The inner traffic selectors cover the inner IPv4 and IPv6 prefixes of each site.
- This lets a dual-stack site reach another over a single IPv6 transport, or carry legacy IPv4 across an IPv6-only path.
MTU overhead
Every tunnel reduces the usable MTU (L4.08). Rough ESP-over-IPv6 overhead on a 1500-byte path:
- ESP/AES-GCM over IPv6, tunnel mode: the encapsulation overhead (outer IPv6 header + ESP header + IV + ICV + padding + next-header) is roughly 54–64 bytes, so plan a tunnel MTU around 1430–1440 and clamp TCP MSS accordingly.
- WireGuard over IPv6 (an alternative VPN, not IPsec): a fixed 80 bytes of overhead, tunnel MTU 1420 (L4.08).
Exact overhead depends on the cipher, IV and padding, so measure with a don't-fragment ping through the tunnel and set the tunnel MTU and MSS from that. Allow ESP (protocol 50) and IKE (UDP 500/4500) through perimeters (L5.05), and allow Packet Too Big so PMTUD works for the tunnel.
strongSwan (IKEv2 over IPv6) sketch
# /etc/swanctl/swanctl.conf (strongSwan)
connections {
site-a-to-b {
version = 2
local_addrs = 2001:db8:3000::1
remote_addrs = 2001:db8:4000::1
proposals = aes256gcm16-prfsha384-ecp384
local { auth = psk; id = site-a }
remote { auth = psk; id = site-b }
children {
net {
# carry both families inside the IPv6 tunnel
local_ts = 2001:db8:3000::/48, 198.51.100.0/24
remote_ts = 2001:db8:4000::/48, 203.0.113.0/24
esp_proposals = aes256gcm16
mode = tunnel
}
}
}
}
Use a certificate or a strong PSK; the example uses PSK for brevity. Command names and config format differ between strongSwan versions (swanctl vs the older ipsec/ipsec.conf) and other stacks (Libreswan, VyOS, MikroTik RouterOS, pf), so check your version's documentation.
ictNetworks scenario
ictNetworks links its Johannesburg and Cape Town PoPs with an IKEv2/ESP (AES-GCM) tunnel over IPv6 between the PoP loopbacks, carrying both the internal IPv6 and the legacy IPv4 management networks. The tunnel MTU is measured and TCP MSS is clamped (L4.08), ESP and IKE are permitted at both edges, and the team's standard answer to "isn't IPv6 secure because of IPsec?" is this lesson: IPsec is a tool they deliberately deploy, not a property they get for free.
Drawing diagram…
Worked examples
Example 1: Correcting the myth
A colleague says IPv6 does not need a VPN because IPsec is mandatory. The correct response: RFC 8504 makes IPsec a SHOULD, it is off until configured, and it protects nothing by itself. A site-to-site link still needs an explicitly configured IKEv2/ESP tunnel (or another VPN).
Example 2: Which mode and protocol
For a site-to-site VPN carrying whole subnets, use ESP in tunnel mode with IKEv2. Transport mode is for host-to-host and cannot carry a different inner network; AH gives no confidentiality; IKEv1 is deprecated.
Example 3: Tunnel MSS
If the measured ESP-over-IPv6 tunnel MTU is 1438, the IPv6 TCP MSS to clamp inside the tunnel is 1438 − 40 − 20 = 1378. (For an inner IPv4 flow the MSS would be 1438 − 20 − 20 = 1398.)
Lab
Goal: Build a site-to-site VPN over IPv6 carrying both protocols and compare MTU overheads.
You need: a lab with two "sites", each a subnet (IPv6 /48 and a legacy IPv4 /24) behind an edge host, connected over an IPv6 "Internet"; strongSwan (or Libreswan) on each edge, and WireGuard for the comparison; hosts on each side.
- Build an IKEv2/ESP tunnel over IPv6 between the edges' GUAs with AES-GCM and an ECP DH group, tunnel mode, with traffic selectors covering both the IPv6 and IPv4 inner prefixes. Bring it up (
swanctl --initiate) and show the SAs. - From a host on site A, reach an IPv6 host and an IPv4 host on site B through the tunnel; capture on the "Internet" link and show only ESP (protocol 50) packets between the edge GUAs, with the inner traffic encrypted.
- Confirm IKEv1 is refused/disabled and that manual keying is not used; show the negotiated proposal (AES-GCM, SHA-2, ECP).
- Measure the tunnel MTU with
ping6 -M do -s ...through the tunnel until it stops, compute the overhead, set the tunnel MTU and clamp TCP MSS (L4.08). Show a large TCP transfer working before and after clamping. - Build a WireGuard tunnel over IPv6 between the same edges, measure its MTU (expect ~1420) and compare the overhead and configuration effort with IPsec in a short table.
- At each edge firewall, show that ESP and IKE (UDP 500/4500) are permitted and that Packet Too Big passes.
What to submit: the IPsec and WireGuard configs, the SA/proposal output, the ESP capture, the MTU measurements and overhead comparison, and the firewall rules.
Summary
- IPsec is a SHOULD in IPv6 (RFC 8504), not mandatory or automatic; it protects nothing until configured.
- Use ESP (protocol 50) with IKEv2 (RFC 7296); IKEv1 is deprecated (RFC 9395); AH gives no confidentiality.
- Transport mode is host-to-host; tunnel mode is for site-to-site and can carry a different inner address family.
- Use AEAD ciphers (AES-GCM, ChaCha20-Poly1305) and strong DH; avoid 3DES and manual keying (RFC 8221/8247).
- A tunnel-mode VPN over IPv6 carries both IPv4 and IPv6; measure the MTU and clamp MSS, and permit ESP/IKE and PTB.
- Next lesson (L5.08): monitoring, logging and incident response.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.