Calculate ESP AES-GCM MTU with IPv4 NAT-T

Budget an IPv4 IPsec tunnel over UDP NAT-T using AES-GCM, a 16-byte ICV and a 1500-byte underlay.

Try these inputs

Worked calculation

  1. Count 20 bytes for IPv4, 8 for UDP NAT-T, 8 for the ESP header, 8 for the explicit IV and 16 for the ICV. The fixed total is 60 bytes.
  2. The remaining 1,440 bytes already align to four. Reserve two bytes for the ESP pad-length and next-header fields, leaving 1,438 for inner IP.
  3. For IPv4 TCP traffic, subtract 40 bytes for the base headers. The MSS is 1,398.

Inputs

IP versions
Use No if the input already reflects the PPPoE interface MTU.

Calculated in your browser

Results

Inner IP MTU
1,438 B
TCP MSS
1,398 B
Budgeted overhead
62 B

Tunnel packet byte budget

Tunnel packet byte budgetThe top bar compares encapsulation overhead with the usable packet. The bottom bar expands the overhead to show its parts in bytes.Underlay budget · 1,500 BInner IPOverhead1,438 B inner IPOverhead detail62 BOuter IPv4: 20 B20UDP NAT-T: 8 B8ESP SPI + sequence: 8 B8ESP explicit IV: 8 B8ESP integrity tag: 16 B16ESP trailer: 2 B
  • Outer IPv4 · 20 B
  • UDP NAT-T · 8 B
  • ESP SPI + sequence · 8 B
  • ESP explicit IV · 8 B
  • ESP integrity tag · 16 B
  • ESP trailer · 2 B
The top bar compares encapsulation overhead with the usable packet. The bottom bar expands the overhead to show its parts in bytes.
Encapsulation
IPsec ESP tunnel
Starting MTU
1,500 B
Inner TCP/IP base headers
40 B
Byte budget
LayerBytes
Outer IPv420
UDP NAT-T8
ESP SPI + sequence8
ESP explicit IV8
ESP integrity tag16
ESP trailer2
Inner IP packet1438

Questions

Should I add a four-byte non-ESP marker to this data packet?

The non-ESP marker identifies IKE on UDP 4500. UDP-encapsulated ESP data starts with its nonzero SPI.

What changes if this AES-GCM tunnel no longer needs UDP NAT-T?

Remove the eight UDP bytes. On this path the remaining size is still aligned, so the tunnel MTU increases by eight.

References