WireGuardLab
Flat isometric illustration of two pink corner walls with large oval openings and glowing padlocks, above a dotted slab crossed by a bright pink line.
troubleshooting

WireGuard MTU Calculator and Fragmentation Fix

Calculate your WireGuard MTU for IPv4, IPv6, or PPPoE. Use Linux ping to check the path, find fragmentation, and clamp TCP MSS on a router.

By WireGuardLab Editorial · ·Updated · 10 min read

With base headers, subtract 60 bytes for outer IPv4 or 80 bytes for outer IPv6 to get the fixed-overhead WireGuard MTU. Over IPv6, that gives 1420 on a 1500-byte path or 1412 on a 1492-byte PPPoE path. Both values fit when the sender caps padding at that MTU. With uncapped padding, round the remainder down to a multiple of 16 bytes. WireGuard protocol and cryptography RFC 768 RFC 791 RFC 8200 RFC 2516 Linux 6.12 WireGuard send code

If the tunnel handshakes and small packets get through but larger transfers stall, measure the path to the peer’s public endpoint, then verify the calculated MTU inside the tunnel. You can also get a starting value from the mesh topology designer.

WireGuard encapsulation overhead

The fixed overhead is 32 bytes for the WireGuard data message, 8 for UDP, and 20 or 40 for the outer IP header. WireGuard protocol and cryptography RFC 8439 RFC 768 RFC 791 RFC 8200

LayerBytes
WireGuard transport data header16
Poly1305 authentication tag16
UDP header8
Outer IPv4 header without options20
Outer IPv6 base header without extensions40

The WireGuard protocol pads the inner packet to a multiple of 16 bytes before encryption. In the Linux 6.12 kernel driver, the padding cap comes from the inner route MTU when available, or the WireGuard interface MTU otherwise. For an inner packet already within that cap, Linux rounds its length up to a multiple of 16 and stops at the cap. WireGuard protocol and cryptography Linux 6.12 WireGuard device code Linux 6.12 WireGuard send code

The calculator

Use the path MTU between the public endpoints. Subtract the fixed overhead and any extra outer IP header bytes. The table uses base headers and shows the resulting MTUs for a sender that caps padding at or below that limit.

If padding is uncapped, round the remainder down to the nearest multiple of 16. A full 1420- or 1412-byte inner packet would pad to 1424 and make a 1504-byte outer IPv6 packet. Rounding down gives 1408 for both paths. If the endpoint can use either address family, calculate both limits and use the smaller one. WireGuard protocol and cryptography RFC 768 RFC 791 RFC 8200 Linux 6.12 WireGuard send code

For TCP inside the tunnel, subtract another 40 bytes from the chosen WireGuard MTU for inner IPv4 or 60 bytes for inner IPv6 to calculate the advertised MSS from the fixed headers. RFC 9293

Example pathPath MTUWG MTU over IPv4, capped paddingWG MTU over IPv6, capped paddingInner IPv4 TCP MSS using capped-padding IPv6 MTU
Ethernet at standard MTU1500144014201380
PPPoE at standard MTU1492143214121372
Suppose probes establish a usable size of 14521452139213721332
Inside an existing tunnel with a usable MTU of 14201420136013401300

Standard PPPoE uses 8 bytes of a 1500-byte Ethernet payload. Some PPPoE links can negotiate a larger MTU, so use the path’s usable IP packet size when you know it. On a path larger than 1500, the fixed-overhead result can exceed 1420. RFC 2516 RFC 4638

If another tunnel sits under WireGuard, account for its overhead first. For 6rd over a 1500-byte IPv4 path, a 1480-byte 6rd MTU leaves 1400 after WireGuard’s fixed IPv6 overhead. For DS-Lite over a 1500-byte IPv6 path, budgeting 40 bytes for DS-Lite leaves 1460 for the IPv4 packet and 1400 after WireGuard’s fixed IPv4 overhead. With uncapped WireGuard padding, round 1400 down to 1392 in both examples. RFC 5969 RFC 6333

If IPv6 travels inside WireGuard, keep the tunnel MTU at 1280 or higher. A 1280-byte tunnel MTU is a troubleshooting starting point when you cannot probe. Since 1280 is already a multiple of 16, that tunnel MTU fits a path MTU of at least 1340 over IPv4 or 1360 over IPv6 with base outer headers. RFC 8200

Why wg-quick usually lands on 1420

On Linux, wg-quick looks up the peer endpoint routes at startup, falls back to the default route when it finds no endpoint MTU, and uses 1500 as a final fallback. It uses the largest MTU found among the peer routes and subtracts 80 from the selected MTU. A selected route MTU of 1500 yields 1420, and a selected PPPoE route MTU of 1492 yields 1412. An explicit MTU setting overrides that calculation. wireguard-tools v1.0.20210914 Linux script RFC 2516

The Linux 6.12 driver sets the initial WireGuard MTU to the Ethernet payload size minus its largest fixed encapsulation overhead, which uses an outer IPv6 base header. Linux 6.12 WireGuard device code A standard Ethernet payload is 1500 bytes. RFC 2516 Subtracting the 80 bytes calculated above gives an initial MTU of 1420 bytes. A route lookup can still miss a smaller link farther along the path, so check again after moving the tunnel to another network. RFC 4821

Measure the path instead of guessing

From the WireGuard host, probe the peer’s public endpoint outside the tunnel. Replace the example address with the actual endpoint address. On Linux, use ip route get to confirm that the probe will take a route outside WireGuard. If the lookup selects the WireGuard interface, arrange the probe during a maintenance window with the tunnel down. ip-route(8)

ip route get 203.0.113.10

Linux iputils ping uses -4 or -6 to select the IP family. With -M do, the probe sets Don’t Fragment and remains subject to the kernel’s path MTU checks. Use -s for the data size, -c for the count, and -W for the reply timeout when there are no responses. iputils ping(8), release 20250605

For an IPv4 endpoint, try a 1472-byte payload, then compare with a small probe if the first size fails. Those 1472 bytes make a 1500-byte IPv4 packet with a 20-byte IP header and an 8-byte ICMP Echo header. iputils ping(8), release 20250605 RFC 791 RFC 792

ping -4 -M do -c 3 -W 2 -s 1472 203.0.113.10
ping -4 -M do -c 3 -W 2 -s 500 203.0.113.10

For an IPv6 endpoint without extension headers, try a 1452-byte payload. Add 48 bytes to the payload for the IPv6 base header and ICMPv6 Echo header. iputils ping(8), release 20250605 RFC 8200 RFC 4443

ping -6 -M do -c 3 -W 2 -s 1452 2001:db8::10
ping -6 -M do -c 3 -W 2 -s 500 2001:db8::10

If small probes reply and larger ones consistently fail, reduce -s until replies return, then try sizes between the largest success and smallest failure. Add 28 for IPv4 or 48 for IPv6 to the largest repeatable payload and use the result as a working path MTU estimate. Try from both peers where possible and use the smaller result if you want one setting for both ends. An unanswered small probe leaves the estimate inconclusive. iputils ping(8), release 20250605 RFC 4821

Once the tunnel is up, check for a recent handshake with wg show wg0, then ping the far end’s tunnel address. The example below compares a small ping with a 1392-byte payload, which fills a 1420-byte WireGuard MTU for inner IPv4. For inner IPv6, subtract 48 from the tunnel MTU and use -6 with the tunnel’s IPv6 address. wg(8) iputils ping(8), release 20250605 RFC 792 RFC 4443

ping -4 -M do -c 3 -W 2 -s 500 10.7.0.1
ping -4 -M do -c 3 -W 2 -s 1392 10.7.0.1

If small tunnel pings also fail, check keys, AllowedIPs, routing and NAT traversal before tuning MTU. After the larger probe passes, retry the transfer that stalled.

Set it on both ends

The WireGuard handshake carries no MTU field. Each peer has its own interface setting, so a mismatch can go unnoticed until data flows. When troubleshooting, start with the smaller usable value on both ends and verify traffic in each direction. WireGuard protocol and cryptography ip-link(8)

To try 1412 on Linux immediately, run this as root, substituting your interface name and calculated MTU. ip-link(8)

ip link set dev wg0 mtu 1412

Saving the MTU with wg-quick involves restarting the tunnel. Use a management connection that stays up. If the configuration contains SaveConfig = true, run wg-quick down wg0 as root before editing, because shutdown will save the running configuration over the file. wg-quick(8)

For wg0, the usual configuration file is /etc/wireguard/wg0.conf. Add MTU under the existing [Interface] section. wg-quick(8)

[Interface]
MTU = 1412

Run the first command as root if the interface is still up. Then run the second to apply the saved MTU. wg-quick(8)

wg-quick down wg0
wg-quick up wg0

For full Linux configurations, see the Ubuntu server and client setup or the Raspberry Pi setup.

WireGuard MTU settings by platform

PlatformWhere 1412 goesWhat happens if you leave it unset
Linux with wg-quickMTU = 1412 in [Interface]Startup route MTU minus 80. wg-quick(8) wireguard-tools v1.0.20210914 Linux script
systemd-networkdMTUBytes=1412 under [NetDev] in the .netdev file. systemd 257 netdev manualThe Linux driver subtracts the fixed IPv6 encapsulation overhead from the Ethernet payload size. Linux 6.12 WireGuard device code The calculation above gives 1420 bytes.
NetworkManagernmcli connection modify wg0 wireguard.mtu 1412, with wg0 as the connection profile nameThe default ignores active routes at activation. NetworkManager 1.52 nmcli manual NetworkManager 1.52 settings manual
WindowsMTU = 1412 in [Interface]Tracks the default-route interface MTU per address family and subtracts 80, subject to a family-specific minimum. Windows configuration parser Windows interface watcher Windows MTU monitor
macOSMTU = 1412 in [Interface]The app supplies 80 bytes of tunnel overhead to macOS. Apple configuration parser Apple tunnel settings generator
iOSMTU = 1412 in [Interface]The app uses 1280. Apple configuration parser Apple tunnel settings generator
Android with the userspace backendMTU = 1412 in [Interface]The Go backend uses 1280. Android interface parser Android Go backend
MikroTik RouterOSSet the WireGuard interface’s mtu property to 1412The documented default is 1420. MikroTik RouterOS WireGuard documentation

Does WireGuard fragment packets?

WireGuard encapsulates each inner packet in a UDP datagram. Fragmentation happens at the IP layer. IPv4 can fragment an oversized outer datagram if the Don’t Fragment bit is clear. IPv6 routers drop oversized packets and report them with ICMPv6 Packet Too Big. Only the IPv6 source can fragment. WireGuard protocol and cryptography RFC 791 RFC 8200 RFC 4443

To look for later IPv4 fragments, run tcpdump as root on the physical interface during a transfer. Replace eth0 with that interface and the example address with the peer’s public IPv4 address. -i selects the interface and -n keeps output numeric. tcpdump(1) pcap-filter(7)

tcpdump -n -i eth0 'host 203.0.113.10 and ip[6:2] & 0x1fff != 0'

This filter matches nonzero fragment offsets. Check whether any matching traffic coincides with your WireGuard transfer. A lost fragment can prevent reassembly of the entire datagram, and some middleboxes discard fragments. pcap-filter(7) RFC 8900

Clamp TCP MSS for forwarded traffic

Set the tunnel MTU first. If a Linux router forwards TCP between a LAN and the tunnel, it can also clamp the advertised MSS in the SYN and SYN-ACK packets. Choose the example that matches the router’s firewall and replace wg0 with its WireGuard interface name. iptables-extensions(8) Netfilter MSS clamping guide

With iptables, run as root. -o matches traffic going into the tunnel and -i matches traffic arriving from it. These commands cover forwarded IPv4 traffic. For forwarded IPv6 traffic on an iptables setup, use the same rules with ip6tables. iptables(8) iptables-extensions(8)

iptables -t mangle -A FORWARD -o wg0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -t mangle -A FORWARD -i wg0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

With nftables, this example adds a table for IPv4 and IPv6. Save it as wireguard-mss.nft, or integrate the rules into your existing forwarding ruleset. nft(8) Netfilter MSS clamping guide

table inet wireguard_mss {
    chain forward {
        type filter hook forward priority mangle;
        iifname "wg0" tcp flags syn tcp option maxseg size set rt mtu
        oifname "wg0" tcp flags syn tcp option maxseg size set rt mtu
    }
}

As root, check the standalone example before loading it. Run the second command only after the check succeeds. nft(8)

nft -c -f wireguard-mss.nft
nft -f wireguard-mss.nft

Retry with a new TCP connection so the endpoints exchange fresh MSS values. Clamping applies only to TCP, so also retry a UDP application if one stalled. QUIC runs over UDP and will still depend on a usable path MTU. RFC 9293 RFC 9000

When path MTU discovery fails

Classic path MTU discovery relies on ICMP errors reaching the sender. If you manage the firewall, allow relevant IPv4 Fragmentation Needed messages (ICMP type 3, code 4) and IPv6 Packet Too Big messages (ICMPv6 type 2, code 0) back to that sender. Missing errors can leave a connection hanging. RFC 792 RFC 4443 RFC 9293 RFC 4821

Linux can probe for a workable packet size on its own TCP connections. As root on the affected TCP host, set net.ipv4.tcp_mtu_probing to 1 to enable probing when Linux detects an ICMP black hole. This changes a runtime setting for TCP. Linux 6.12 IP sysctl documentation sysctl(8)

sysctl -w net.ipv4.tcp_mtu_probing=1

Looking for a WireGuard AllowedIPs calculator?

AllowedIPs takes a list of IP prefixes. To exclude a local subnet while routing the remaining IPv4 addresses through the tunnel, use Python’s address_exclude() to calculate the remaining prefixes. Then enter those prefixes as shown in the AllowedIPs guide. wg(8) Python 3.13 ipaddress documentation

from ipaddress import ip_network

remaining = ip_network("0.0.0.0/0").address_exclude(ip_network("192.168.1.0/24"))
print(", ".join(str(prefix) for prefix in remaining))

Evidence and limits. The calculations are based on the WireGuard protocol and cited RFCs. The Linux examples were checked against Linux 6.12, wireguard-tools v1.0.20210914, iputils 20250605, and the linked manuals. No hands-on testing was performed for this guide.

See also

Sources

  1. WireGuard protocol and cryptography
  2. RFC 768
  3. RFC 791
  4. RFC 8200
  5. RFC 2516
  6. RFC 8439
  7. Linux 6.12 WireGuard send code
  8. RFC 9293
  9. RFC 4638
  10. RFC 5969
  11. RFC 6333
  12. wireguard-tools v1.0.20210914 Linux script
  13. Linux 6.12 WireGuard device code
  14. ip-route(8)
  15. iputils ping(8), release 20250605
  16. RFC 792
  17. RFC 4443
  18. RFC 4821
  19. wg(8)
  20. ip-link(8)
  21. wg-quick(8)
  22. systemd 257 netdev manual
  23. NetworkManager 1.52 nmcli manual
  24. NetworkManager 1.52 settings manual
  25. Windows configuration parser
  26. Windows interface watcher
  27. Windows MTU monitor
  28. Apple configuration parser
  29. Apple tunnel settings generator
  30. Android interface parser
  31. Android Go backend
  32. MikroTik RouterOS WireGuard documentation
  33. tcpdump(1)
  34. pcap-filter(7)
  35. RFC 8900
  36. iptables-extensions(8)
  37. Netfilter MSS clamping guide
  38. iptables(8)
  39. nft(8)
  40. RFC 9000
  41. Linux 6.12 IP sysctl documentation
  42. sysctl(8)
  43. Python 3.13 ipaddress documentation

Related