# Debug VXLAN, Geneve, WireGuard & IPsec Tunnel MTU Black Holes Offline

> **FrameAssembly v3.2.2** · Operational Playbook (Routing, VLANs & Overlays) · Canonical URL: https://frameassembly-lang.dev/use-cases/vxlan-wireguard-ipsec-tunnel-pcap

Verify underlay ACLs allow UDP 4789/6081/4500/51820, IP Proto 50 ESP, and ICMP Code 4 Path MTU Discovery before tunnels hang on TLS.

- **Category:** Routing, VLANs & Overlays
- **Capture Filename:** `overlay_vpn_mtu.frasm` (12 Ethernet frames)
- **Protocols Exercised:** `vxlan`, `geneve`, `udp`, `icmp`, `ikev2`, `esp`, `wireguard`

## Operational Problem

Pings pass across the new cloud tunnel because 64-byte packets fit anywhere, then every real HTTPS or database query freezes solid because an underlay firewall blocks ICMP Fragmentation Needed or silently drops IP Protocol 50 ESP.

Data-center fabrics (EVPN VXLAN on UDP 4789, Cilium/OVN/GWLB Geneve on UDP 6081) and site-to-site VPNs (IKEv2 NAT-T on UDP 500/4500 + ESP Proto 50, WireGuard on UDP 51820) shave 50 to 80 bytes off your usable MTU.

Testing all four encapsulations—plus `df` (Don’t Fragment) probes and `icmp destunreach code 4` Path MTU Discovery replies—normally requires deploying multi-cloud gateways and IPsec daemons just to capture twelve packets.

## Scenario & Topology: Hybrid-Cloud Underlay Audit: VXLAN + Geneve + PMTUD + IKEv2/ESP + WireGuard

- **Topology:** `Spine VTEP / Branch VPN (172.16.254.10) <-> Transit Firewall <-> Cloud VTEP / Hub (172.16.254.20)`

Twelve packets verify every tunnel pipe and MTU edge case in one capture: (1) DF-marked `vxlan` (`vni 10400`) and `geneve` (`vni 20800`); (2) an oversized `df` UDP probe answered by `icmp destunreach code 4` (Fragmentation Needed); (3) `ikev2 sainit` on UDP 500 floating to NAT-T UDP 4500 `auth` + `esp` (`spi 0xc0ffee01`); and (4) a 1-RTT `wireguard` Noise_IK handshake (`initiation` -> `response` -> `data`).

## FrameAssembly Workflow

Compiles 12 underlay frames covering VXLAN, Geneve, DF/ICMP Code 4 PMTUD, IKEv2 NAT-T + ESP, and exact-length WireGuard.

### Adapt It for Your Network

1. Replace spine_vtep and remote_vtep with your underlay VTEP or WAN gateway public/transit IPs.
2. Adjust vni 10400/20800, IKEv2 SPIs, ESP spi, or WireGuard sender/receiver indices to match your lab.
3. Compile -> inspect VXLAN, Geneve, ISAKMP, ESP, and WireGuard dissectors in Wireshark -> replay across your transit firewall.

## Runnable Capture Specification (`overlay_vpn_mtu.frasm`)

```frameassembly
host spine_vtep  { ip 172.16.254.10 mac 00:1c:73:c0:00:10 }
host remote_vtep { ip 172.16.254.20 mac 00:1c:73:c0:00:20 }

flow dc_overlays_and_pmtud(local_gw, peer_gw) {
    // 1. EVPN VXLAN (UDP 4789, VNI 10400) & Cilium/GWLB Geneve (UDP 6081, VNI 20800)
    local_gw -> peer_gw df vxlan vni 10400 payload "INNER_TENANT_FRAME" wait 1ms
    local_gw -> peer_gw df geneve vni 20800 optclass 0x0104 opttype 1 protocoltype 0x6558 wait 2ms

    // 2. Path MTU Discovery (DF=1 probe -> ICMP Type 3 Code 4 Fragmentation Needed)
    local_gw -> peer_gw df ipid 9001 udp srcport 54000 dstport 4789 payload "OVERSIZED_TUNNEL_DF_PROBE" wait 1ms
    local_gw <- peer_gw icmp destunreach code 4 wait 3ms
}

flow site_to_site_ipsec_and_wireguard(local_gw, peer_gw) {
    // 3. IKEv2 SA_INIT (UDP 500) -> NAT-T float (UDP 4500 AUTH) + IPsec ESP (Proto 50)
    local_gw -> peer_gw ikev2 sainit initiatorspi 0xa1b2c3d4e5f60102 responderspi 0 msgid 0 flags 0x08 nextpayload 33 wait 2ms
    local_gw <- peer_gw ikev2 sainit initiatorspi 0xa1b2c3d4e5f60102 responderspi 0x1122334455667788 msgid 0 flags 0x20 nextpayload 33 wait 2ms
    local_gw -> peer_gw ikev2 auth srcport 4500 dstport 4500 initiatorspi 0xa1b2c3d4e5f60102 responderspi 0x1122334455667788 msgid 1 flags 0x08 nextpayload 46 wait 2ms
    local_gw <- peer_gw ikev2 auth srcport 4500 dstport 4500 initiatorspi 0xa1b2c3d4e5f60102 responderspi 0x1122334455667788 msgid 1 flags 0x20 nextpayload 46 wait 2ms
    local_gw -> peer_gw esp spi 0xc0ffee01 seq 1 iv "0011223344556677" icv "8899aabbccddeeff00112233" wait 2ms

    // 4. WireGuard 1-RTT handshake (148B Initiation -> 92B Response) + AEAD Data
    local_gw -> peer_gw wireguard initiation sender 0x01020304 wait 1ms
    local_gw <- peer_gw wireguard response sender 0x05060708 receiver 0x01020304 wait 1ms
    local_gw -> peer_gw wireguard data receiver 0x05060708 counter 0 payload "WG_INNER_PACKET" wait 1ms
}

compile {
    dc_overlays_and_pmtud(spine_vtep, remote_vtep)
    site_to_site_ipsec_and_wireguard(spine_vtep, remote_vtep)
}
```

## Equivalent CLI Commands

```bash
# 1. Compile the VXLAN, Geneve, PMTUD, IPsec & WireGuard capture
frameassembly overlay_vpn_mtu.frasm overlay_vpn_mtu.pcap

# 2. Verify VXLAN/Geneve VNIs, DF bits, IKEv2 SPIs, ESP, and WireGuard in tshark
tshark -r overlay_vpn_mtu.pcap

# 3. Replay across underlay switches, cloud GWLB appliances, or Suricata NDR
sudo tcpreplay -i eth0 overlay_vpn_mtu.pcap
```

## Protocol Reference Links

- [`vxlan` — Virtual eXtensible Local Area Network Overlay](https://frameassembly-lang.dev/docs/protocols/vxlan) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/vxlan.md))
- [`geneve` — Generic Network Virtualization Encapsulation](https://frameassembly-lang.dev/docs/protocols/geneve) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/geneve.md))
- [`udp` — User Datagram Protocol](https://frameassembly-lang.dev/docs/protocols/udp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/udp.md))
- [`icmp` — Internet Control Message Protocol v4 & Dual-Stack ICMPv6](https://frameassembly-lang.dev/docs/protocols/icmp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/icmp.md))
- [`ikev2` — Internet Key Exchange Protocol Version 2](https://frameassembly-lang.dev/docs/protocols/ikev2) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/ikev2.md))
- [`esp` — IPsec Encapsulating Security Payload](https://frameassembly-lang.dev/docs/protocols/esp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/esp.md))
- [`wireguard` — WireGuard Noise_IK Secure Network Tunnel](https://frameassembly-lang.dev/docs/protocols/wireguard) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/wireguard.md))
