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 inputs

Worked calculation

  1. The fixed IPv6, ESP header, 16-byte IV and 16-byte tag take 40 + 8 + 16 + 16 = 80 bytes.
  2. 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.
  3. Subtract 40 bytes for inner IPv6 and 20 for TCP. MSS is 1,346 bytes.

Inputs

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

Calculated in your browser

Results

Inner IP MTU
1,406 B
TCP MSS
1,346 B
Budgeted overhead
94 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,406 B inner IPOverhead detail94 BOuter IPv6: 40 B40ESP SPI + sequence: 8 B8ESP explicit IV: 16 B16ESP integrity tag: 16 B16ESP trailer: 2 BAlignment headroom: 12 B12
  • 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
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
60 B
Byte budget
LayerBytes
Outer IPv640
ESP SPI + sequence8
ESP explicit IV16
ESP integrity tag16
ESP trailer2
Alignment headroom12
Inner IP packet1406

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.

References