MTU and MSS calculator
Start from the MTU of the link, add the tunnels and encapsulations on the path, and get the largest packet that fits inside, the TCP MSS to clamp to, and ping commands for Windows, Linux and macOS that test it.
Test it with ping
Each command sends the largest packet that should fit, with fragmenting turned off. If replies come back, the path carries it; if not, make the size smaller until they do.
Windows
Linux
macOS
- Windows:
/fsets the Do not Fragment flag, for IPv4 only, and/lis the size of the data (Microsoft's ping reference). Windows ping has no such switch for IPv6. - Linux:
-M dosets the DF flag and has the kernel refuse packets that are too large;-sis the number of data bytes. The second line tests IPv6. - macOS:
-Dsets the Don't Fragment bit. - The data is the packet less 28 bytes for IPv4 (a 20-byte IPv4 header and an 8-byte ICMP header) and less 48 for IPv6 (a 40-byte IPv6 header and an 8-byte ICMPv6 header).
Overheads
What each layer adds to a packet, in bytes. IPsec ESP also pads the packet so that its end falls on a 4-byte boundary, or a 16-byte one with AES-CBC, so its overhead changes with the size of the packet.
| Layer | Bytes | What they are | Source |
|---|---|---|---|
| PPPoE | 8 | PPPoE header 6, PPP protocol ID 2 | RFC 2516 |
| GRE over IPv4 | 24 | Outer IPv4 header 20, GRE header 4 | RFC 2784 |
| GRE with a key, over IPv4 | 28 | Outer IPv4 header 20, GRE header 4, key 4 | RFC 2784, RFC 2890 |
| VXLAN over IPv4 | 50 | Outer IPv4 header 20, UDP 8, VXLAN header 8, inner Ethernet header 14 | RFC 7348 |
| VXLAN over IPv6 | 70 | Outer IPv6 header 40, UDP 8, VXLAN header 8, inner Ethernet header 14 | RFC 7348 |
| WireGuard over IPv4 | 60 | Outer IPv4 header 20, UDP 8, WireGuard header 16, authentication tag 16 | Linux WireGuard |
| WireGuard over IPv6 | 80 | Outer IPv6 header 40, UDP 8, WireGuard header 16, authentication tag 16 | Linux WireGuard |
| IPsec ESP tunnel, AES-GCM, over IPv4 | 54 + padding | Outer IPv4 header 20, ESP header 8, IV 8, padding to 4 bytes, pad length and next header 2, ICV 16 | RFC 4303, RFC 4106 |
| IPsec ESP tunnel, AES-GCM, over IPv4 with NAT traversal | 62 + padding | As above, and UDP 8 | RFC 4303, RFC 4106, RFC 3948 |
| IPsec ESP tunnel, AES-CBC and SHA-256, over IPv4 | 62 + padding | Outer IPv4 header 20, ESP header 8, IV 16, padding to 16 bytes, pad length and next header 2, ICV 16 | RFC 4303, RFC 3602, RFC 4868 |
| IPsec ESP tunnel, AES-CBC and SHA-256, over IPv4 with NAT traversal | 70 + padding | As above, and UDP 8 | RFC 4303, RFC 3602, RFC 4868, RFC 3948 |
| IPsec ESP tunnel, AES-CBC and SHA-1, over IPv4 | 58 + padding | Outer IPv4 header 20, ESP header 8, IV 16, padding to 16 bytes, pad length and next header 2, ICV 12 | RFC 4303, RFC 3602, RFC 2404 |
| IPsec ESP tunnel, AES-GCM, over IPv6 | 74 + padding | Outer IPv6 header 40, ESP header 8, IV 8, padding to 4 bytes, pad length and next header 2, ICV 16 | RFC 4303, RFC 4106 |
MSS and clamping
The TCP MSS is the most data one TCP segment carries: the MTU less 40 bytes for IPv4 (a 20-byte IPv4 header and a 20-byte TCP header) and less 60 for IPv6, whose header is 20 bytes longer (RFC 8200 section 8.3, RFC 9293 section 3.7.1).
When a tunnel makes the path smaller than the hosts know, the routers or firewalls at its ends can lower the MSS in the TCP handshakes that pass through, so that TCP sends smaller segments. RFC 4459 calls this MSS clamping. It works for TCP only, not for UDP, and it is most used with PPPoE.
Limits and defaults
- IPv6 needs an MTU of at least 1280 on every link, and only the sender may fragment an IPv6 packet, never a router (RFC 8200). IPv4 needs at least 68 (RFC 791).
- PPPoE's 1492 is 1500 less a 6-byte PPPoE header and a 2-byte PPP protocol ID (RFC 2516). RFC 4638 lets both ends agree on more when the Ethernet link carries larger frames.
- WireGuard on Linux gives a new interface an MTU of 1420: 1500 less 80, room for an IPv6 outer header. wg-quick takes 80 off the MTU of the route to each peer unless the configuration sets MTU. WireGuard pads each packet to a multiple of 16 bytes, but never past the MTU.
- VXLAN carries the whole Ethernet frame, so the inner 14-byte Ethernet header counts too. RFC 7348 says the tunnel ends must not fragment VXLAN packets, and recommends a larger MTU on the network underneath.
- On Windows, the PowerShell command Set-NetIPInterface sets the MTU of an interface: for example
Set-NetIPInterface -InterfaceAlias Ethernet -NlMtuBytes 1400.
Sources
- Headers: RFC 791 (IPv4), RFC 8200 (IPv6), RFC 768 (UDP), RFC 792 and RFC 4443 (ICMP echo), RFC 9293 (TCP). PPPoE: RFC 2516 and RFC 4638. GRE: RFC 2784 and RFC 2890. VXLAN: RFC 7348. IPsec: RFC 4303, RFC 4106, RFC 3602, RFC 4868, RFC 2404 and RFC 3948.
- WireGuard: the Linux kernel's drivers/net/wireguard (v7.3) and wg-quick (wireguard-tools v1.0.20260223). VXLAN and PPPoE header sizes also in the Linux kernel (vxlan.h, if_pppox.h).
- MSS: RFC 8200 section 8.3, RFC 9293 section 3.7.1 and RFC 4459 section 3.2.
- ping: Microsoft's ping reference (windowsserverdocs at commit b640f2c), iputils ping 20250605, Apple's ping (network_cmds-741.100.2). Set-NetIPInterface: Microsoft's PowerShell reference (windows-powershell-docs at commit 8fc3941).
- Microsoft's documentation is used under the Creative Commons Attribution 4.0 International licence (creativecommons.org/
licenses/ by/ 4.0/). The names in the tables are Microsoft's; the words around them are written here in plain words.
More Network tools
-
CIDR subnet calculator
Network, broadcast, host range, subnet mask and wildcard mask for IPv4 and IPv6 prefixes.
-
IP range to CIDR converter
Turn a range such as 10.0.0.5-10.0.0.70 into CIDR blocks, merge a list of blocks, and check whether an address is in it.
-
IP address type checker
See whether an address is private, CGNAT, link-local, loopback, documentation, multicast or public, with its RFC.
-
IPv6 expander, compressor and reverse name
Write an IPv6 address in full or in its shortest form, get its ip6.arpa name, or build one from a MAC address.
-
MAC address format converter
Convert MAC addresses between colons, dashes, Cisco's dotted form and plain hex, and read the multicast and local bits.
-
Port number lookup
Look up a port such as 445 or 5985, or a service name, in IANA's registry, with what Windows and Active Directory use it for.
-
DHCP option encoder and decoder
Build or read the hex of option 121 and 249 static routes, option 119 search lists and option 43 for Cisco and UniFi.
-
NPS reason code lookup
Read why Network Policy Server denied a request: events 6273 and 6274, and reason codes such as 16, 48 and 65.
-
Wi-Fi reason and status codes
Look up 802.11 deauthentication and disassociation reason codes and association status codes.
-
DSCP and ToS converter
Convert DSCP, ToS and CoS values, with the Wi-Fi priorities of RFC 8325 and the Teams QoS markings.