Skip to content
Mailwel
Theme

MTU and MSS calculator

Add the layers your traffic passes through, such as PPPoE, a VLAN or a VPN tunnel, to see the MTU left inside and the TCP MSS to use.

The largest IP packet the physical link carries: 1500 on most Ethernet and internet links, often 9000 with jumbo frames.

Layers, outermost first
  1. WireGuard over IPv6 40 IPv6 + 8 UDP + 32 WireGuard (16 header + 16 auth tag)80 bytes
Traffic inside the tunnel

Used in the commands below.

Try:

Result

1500-byte link, 1 layer

Example: WireGuard over IPv6. Add your own layers above.

MTU inside1420 bytes80 bytes of overhead
TCP MSS, IPv41380 bytes
TCP MSS, IPv61360 bytes
Data per packet with TCP timestamps
1368 (IPv4), 1348 (IPv6) bytes

Layer by layer

LayerBytesMTU after
Link1500
WireGuard over IPv6801420
  • Layer
    Link
    Bytes
    MTU after
    1500
  • Layer
    WireGuard over IPv6
    Bytes
    80
    MTU after
    1420

Commands

Set the MTU on the innermost interface (run as root):

ip link set dev eth0 mtu 1420

On a router or VPN gateway, clamp the MSS of TCP connections forwarded out of eth0, using iptables:

iptables -t mangle -A FORWARD -o eth0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1380
ip6tables -t mangle -A FORWARD -o eth0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1360

or nftables (this assumes an inet table called filter with a forward chain):

nft add rule inet filter forward oifname "eth0" meta nfproto ipv4 tcp flags syn tcp option maxseg size set 1380
nft add rule inet filter forward oifname "eth0" meta nfproto ipv6 tcp flags syn tcp option maxseg size set 1360

To follow the route's MTU instead of a fixed number, use --clamp-mss-to-pmtu in place of --set-mss (iptables) or size set rt mtu (nftables). Connections made by the machine itself pick their MSS from the interface MTU, so they don't need clamping.