How to Find Optimal MTU Size with Ping Command: Stop Packet Fragmentation

How to Find Optimal MTU Size with Ping Command: Stop Packet Fragmentation

In computer networking, **Maximum Transmission Unit (MTU)** defines the largest physical packet size (in bytes) that your device can transmit across a network link without splitting it into multiple smaller fragments. When your operating system's MTU is set higher than what your router or Internet Service Provider (ISP) supports, every single packet is split into two fragments (**Packet Fragmentation**), cutting network throughput in half and causing random packet loss in online games. Here is how to find and configure your optimal MTU size using simple ping commands.

1. The Mathematics of MTU: Packet Headers Explained

On standard Ethernet and modern fiber broadband, the default maximum frame size is 1500 bytes. When you send data using the Internet Control Message Protocol (ICMP ping), the total packet consists of three components:

  • IP Header: Consumes exactly 20 bytes.
  • ICMP Header: Consumes exactly 8 bytes.
  • Data Payload: The remaining bytes (e.g. 1500 - 28 = 1472 bytes).
Total MTU = Tested Ping Payload + 28 bytes (20 bytes IP Header + 8 bytes ICMP Header)

2. 💻 How to Test MTU on Windows (Ping -f -l)

On Windows, you can test your network path using the ping command with the -f (Set Don't Fragment flag) and -l (Packet Buffer Size) parameters:

  1. Open Command Prompt as Administrator.
  2. Run the initial test with a 1472-byte payload against a fast public DNS resolver (Cloudflare 1.1.1.1):
    ping 1.1.1.1 -f -l 1472
  3. Analyze the output:
    • "Packet needs to be fragmented but DF set": The packet is too large for your network link. Lower the number by 10 (e.g. 1462) and re-test.
    • "Reply from 1.1.1.1: bytes=... time=...": The packet passed without fragmentation. Increase the number by 1 until you find the exact highest number that replies successfully.
  4. Once you find the maximum non-fragmented payload (e.g. 1464), add 28 bytes to calculate your true MTU:
    Optimal MTU = 1464 + 28 = 1492

3. 🍎 How to Test MTU on macOS & Linux (Ping -D -s)

On macOS and Linux systems, the syntax uses -D (Don't Fragment) and -s (Packet Size):

// macOS command:

ping -D -s 1472 1.1.1.1

// Linux command:

ping -M do -s 1472 1.1.1.1

4. 🌐 Standard MTU Values by Connection Type

Connection Type Typical Optimal MTU Max Ping Payload Reason / Overhead
Standard Ethernet / FTTH Fiber (DHCP) 1500 1472 Standard IEEE 802.3 baseline
PPPoE Fiber / DSL Connections 1492 1464 PPPoE encapsulation adds 8 bytes overhead
Corporate IPsec / SSL VPN 1400 – 1420 1372 – 1392 Encryption headers add 60-80 bytes
PlayStation Network / Nintendo Switch 1472 – 1500 1444 – 1472 Prevents P2P packet fragmentation

5. ⚙️ How to Apply Your Optimal MTU in Windows

Once you have calculated your optimal MTU, apply it permanently to your network adapter using Windows PowerShell or Command Prompt:

  1. Identify your adapter name:
    netsh interface ipv4 show subinterfaces
  2. Set the new MTU value (replace "Ethernet" and 1492 with your details):
    netsh interface ipv4 set subinterface "Ethernet" mtu=1492 store=persistent

6. 🕳️ Path MTU Discovery (PMTUD) & "Black Hole" Routers

Modern operating systems attempt to automatically negotiate MTU using Path MTU Discovery (PMTUD / RFC 1191). When your device sends a packet with the Don't Fragment (DF) bit set and a transit router cannot forward it, the router is supposed to reply with an ICMP Type 3, Code 4 (Fragmentation Needed) message containing its maximum supported MTU.

However, many misconfigured enterprise firewalls and budget ISP routers block all ICMP messages for security reasons. When ICMP is blocked, your computer never receives the fragmentation notification, creating an MTU Black Hole: your connection hangs indefinitely when loading large HTTPS websites or downloading game updates, while simple text sites load normally.

7. 🛡️ TCP MSS Clamping in Routers & Firewalls

If you run an advanced home router (OpenWrt, pfSense, OPNsense, or MikroTik), you can fix MTU mismatches for all household devices at the router level using TCP Maximum Segment Size (MSS) Clamping. MSS clamping automatically rewrites the TCP SYN negotiation headers of all outbound connections:

TCP MSS = MTU - 40 bytes (20 bytes IP Header + 20 bytes TCP Header)

On a 1492 PPPoE connection, setting TCP MSS to 1452 ensures that no client device ever attempts to send a packet larger than the WAN link can carry, completely eliminating black hole hangs.

8. 🌐 IPv6 Fixed MTU Architecture (Minimum 1280 Bytes)

Unlike IPv4, where intermediate routers along the path were permitted to fragment packets on the fly, IPv6 strictly prohibits router-level packet fragmentation. In an IPv6 network, all packet fragmentation must be performed exclusively by the sending host.

The IPv6 standard specifies a mandatory minimum MTU of 1280 bytes. If any link in the network path cannot handle 1280 bytes, IPv6 traffic fails completely. When testing IPv6 MTU, run ping -6 -l 1452 2606:4700:4700::1111 to verify that your IPv6 tunnel (or native dual-stack ISP) does not drop packets.

9. 🎮 Console MTU Tuning: PS5 & Xbox Series X

On gaming consoles, setting MTU to Manual: 1472 (or 1450 for PPPoE fiber) prevents multiplayer packet fragmentation in peer-to-peer matchmaking games like Call of Duty and FIFA/EA Sports FC. Eliminating fragmentation reduces frame pacing jitter and prevents mid-game lobby disconnects.

⚡ Test Your Latency & Jitter After MTU Optimization

Verify that your packet fragmentation is resolved and measure your new connection response times:

🚀 Run Speed & Latency Test →

Frequently Asked Questions

What is the best MTU size for gaming?

For standard fiber/cable, 1500 is optimal. For PPPoE connections, 1492 prevents fragmentation. Setting MTU to match your ISP's exact maximum transmission unit eliminates packet drops.

Does lowering MTU improve ping in games?

Lowering MTU only improves ping if your previous setting was causing packet fragmentation. Lowering it below your line's optimal threshold adds packet header overhead and reduces overall throughput.

What happens if MTU is set too high?

Packets exceeding the network link capacity must be fragmented into multiple smaller packets by routers along the route, doubling packet processing load and increasing latency and packet loss.

Sources & References

See our research methodology for how we combine our own testing with public data sources.

About the Author

Dalto Cardoso is the founder of DCSpeedTest, a digital nomad who has tested internet connections across multiple countries and runs his own VPS infrastructure for clients worldwide. He holds certifications from Google and Meta Blueprint.