Account for AES-CBC ESP padding over an IPv6 underlay
Calculate the largest inner IPv6 packet for a 1500-byte IPsec path with AES-CBC and a 16-byte authentication tag.
Try these inputsWorked calculation
- The fixed IPv6, ESP header, 16-byte IV and 16-byte tag take 40 + 8 + 16 + 16 = 80 bytes.
- The encrypted ESP payload and trailer must fit a multiple of 16. Round 1,420 down to 1,408 and reserve two trailer bytes for an MTU of 1,406.
- Subtract 40 bytes for inner IPv6 and 20 for TCP. MSS is 1,346 bytes.
Results
- Inner IP MTU
- 1,406 B
- TCP MSS
- 1,346 B
- Budgeted overhead
- 94 B
Tunnel packet byte budget
- Outer IPv6 · 40 B
- ESP SPI + sequence · 8 B
- ESP explicit IV · 16 B
- ESP integrity tag · 16 B
- ESP trailer · 2 B
- Alignment headroom · 12 B
- Encapsulation
- IPsec ESP tunnel
- Starting MTU
- 1,500 B
- Inner TCP/IP base headers
- 60 B
| Layer | Bytes |
|---|---|
| Outer IPv6 | 40 |
| ESP SPI + sequence | 8 |
| ESP explicit IV | 16 |
| ESP integrity tag | 16 |
| ESP trailer | 2 |
| Alignment headroom | 12 |
| Inner IP packet | 1406 |
Questions
Are the 12 bytes of alignment headroom always sent on the wire?
They are unused underlay capacity at the largest aligned inner size. Smaller packets can have different actual ESP padding.
Which ESP fields must fit together in the AES-CBC block?
The inner packet, its padding, pad-length byte and next-header byte are the aligned portion in this tunnel profile.