Home▸Cybersecurity▸IPsec Packet Builder 2D: AH vs ESP, Transport vs Tunnel, NAT Traversal

IPsec Packet Builder 2D: AH vs ESP, Transport vs Tunnel, NAT Traversal

Build an IPsec packet byte by byte on a 2D byte-accurate stack: switch between AH and ESP, Transport and Tunnel mode, and toggle a NAT router on the path to see why AH breaks under NAT while ESP survives it through NAT-Traversal. Drag the packet along the wire or scrub the payload-size slider to watch every header layer resize live.

Cybersecurity2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-network-security-cybersecurity-2 ↗ Open standalone

Every IPsec-protected packet is built from the same two choices: which header protects it (AH for integrity only, ESP for encryption) and which mode wraps it (Transport, which keeps the original IP header on the wire, or Tunnel, which encapsulates the whole original packet inside a fresh one for gateway-to-gateway VPNs). This 2D simulator renders that packet as a byte-proportional stack of header blocks travelling across a network path from a source host to a destination host, with a togglable NAT router in the middle and a live byte-accurate breakdown panel underneath. Switch AH on with NAT enabled and watch the receiver's integrity check fail and the packet get dropped — because AH's authentication hash covers the very IP addresses NAT has to rewrite. Switch to ESP and the packet survives, automatically picking up an 8-byte NAT-Traversal UDP wrapper so the NAT device has a port to translate. Drag the packet along the wire to scrub to any point manually, or drag the payload-size slider to watch every header layer resize live. Live readouts track the original payload size, the total wire size after encapsulation, the IPsec overhead in bytes and percent, and the pass/fail state of the integrity check at the receiver.

⚙ Under the hood

Build an IPsec-protected packet header by header on a byte-accurate 2D stack and send it across a network path with a togglable NAT router, showing why AH's integrity check fails under NAT while ESP survives via NAT-Traversal. Drag the packet along the wire or drag the payload-size slider to watch every header layer resize live.

IPsecAHESPNAT traversalVPNpacket encapsulation

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)