---
title: "Calculate the optimal MTU for a WireGuard VPN tunnel interface with a detailed overhead breakdown. Accounts for WireGuard header (32 bytes), outer IP header (20 bytes IPv4 or 40 bytes IPv6), UDP header (8 bytes), and optional PPPoE encapsulation (8 bytes). Prevents fragmentation and PMTUD black holes by computing the maximum inner packet size that fits within the physical link MTU. Essential for WireGuard setup on residential ISP connections (PPPoE), IPv6 tunnels, and any VPN where incorrect MTU causes slow or stalled connections."
method: POST
path: "/api/wireguard_mtu"
tags: ["homelab"]
---

# Calculate the optimal MTU for a WireGuard VPN tunnel interface with a detailed overhead breakdown. Accounts for WireGuard header (32 bytes), outer IP header (20 bytes IPv4 or 40 bytes IPv6), UDP header (8 bytes), and optional PPPoE encapsulation (8 bytes). Prevents fragmentation and PMTUD black holes by computing the maximum inner packet size that fits within the physical link MTU. Essential for WireGuard setup on residential ISP connections (PPPoE), IPv6 tunnels, and any VPN where incorrect MTU causes slow or stalled connections.

`POST /api/wireguard_mtu`

## Request

- Base URL: `https://calc.engineer`
- URL: `https://calc.engineer/api/wireguard_mtu`
- Auth: none declared

## Request body

- object
  - `interface_mtu` number: MTU of the underlying physical or virtual network interface in bytes
  - `ipv6` boolean: Whether the outer (transport) IP header uses IPv6 (40 bytes) instead of IPv4 (20 bytes)
  - `over_pppoe` boolean: Whether the link uses PPPoE encapsulation (adds 8 bytes of overhead)

## Response `200`

Computed result for wireguard_mtu

- object
  - `result` object, required
    - `wireguard_mtu` number, required: Optimal MTU to set on the WireGuard tunnel interface in bytes
    - `overhead_bytes` number, required: Total encapsulation overhead in bytes subtracted from interface MTU
    - `breakdown` object, required
      - `wireguard_header` number, required: WireGuard protocol header overhead in bytes (always 32)
      - `ip_header` number, required: Outer IP header size: 20 bytes for IPv4, 40 bytes for IPv6
      - `udp_header` number, required: UDP header overhead in bytes (always 8)
      - `pppoe_header` number, required: PPPoE encapsulation overhead in bytes (0 or 8)
  - `tool` string, required
  - `version` string, required
  - `computed_at` string, date-time, required
  - `chain` object, required
    - `feeds` unknown[]
      - unknown
    - `accepts_from` unknown[]
      - unknown

## Other responses

- `400`: Validation error or invalid JSON
- `404`: Tool not found

---

[API](https://skmtc.dev/calc/apis/calc-engineer-api.md) · [All operations](https://skmtc.dev/calc/apis/calc-engineer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/calc/apis/calc-engineer-api/revisions/8830480ec488?raw)
