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 inputsWorked calculation
- 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.
- 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.
- For IPv4 TCP traffic, subtract 40 bytes for the base headers. The MSS is 1,398.
Results
- Inner IP MTU
- 1,438 B
- TCP MSS
- 1,398 B
- Budgeted overhead
- 62 B
Tunnel packet byte budget
- 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
- Encapsulation
- IPsec ESP tunnel
- Starting MTU
- 1,500 B
- Inner TCP/IP base headers
- 40 B
| Layer | Bytes |
|---|---|
| Outer IPv4 | 20 |
| UDP NAT-T | 8 |
| ESP SPI + sequence | 8 |
| ESP explicit IV | 8 |
| ESP integrity tag | 16 |
| ESP trailer | 2 |
| Inner IP packet | 1438 |
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.