The Story of the “Truck” and Mysterious Network Lag
I once managed a data center cluster running storage services for about 50 employees. At one point, people complained that internal web access was extremely slow. Even when SSHing into the server, the screen would frequently freeze. Strangely, when running iperf3, the bandwidth still reported approximately 1Gbps, with a latency of only 1-2ms.
After some investigation, I realized the problem wasn’t the connection speed, but the packet size. Imagine data as trucks passing through a tunnel. If the truck is too high (large packet) and the tunnel is too low (small MTU of an intermediate device), the truck has to stop to unload goods into smaller trucks (Fragmentation). Worse, the truck might get stuck entirely, leading to packet loss. Fine-tuning MTU, Jumbo Frames, and MSS Clamping is how we redesign the “truck” size to fit every road.
Why is Packet Fragmentation a Disaster?
In the networking world, 1500 bytes is the standard MTU (Maximum Transmission Unit). A 10MB file will be broken down into thousands of 1500-byte packets to be sent.
Trouble arises when these packets pass through narrower “pipes” like VPNs or PPPoE. These connections often only allow 1492 or 1450 bytes because they need extra space for encapsulation headers. At this point, the router is forced to perform Fragmentation. It splits the packet in two, sends them, and the receiver must reassemble them. This process consumes the router’s CPU and increases latency by 2-3 times. In many cases, packets are dropped entirely, causing the connection to hang at 99%.
Mastering the Parameters: MTU, Jumbo Frames, and MSS
- MTU (Maximum Transmission Unit): The maximum size of a data frame at Layer 2.
- MSS (Maximum Segment Size): The actual data payload within a TCP packet. MSS usually equals MTU minus 40 bytes of headers (20 bytes IP + 20 bytes TCP). With an MTU of 1500, the ideal MSS is 1460.
- Jumbo Frames: Packets with an MTU of up to 9000 bytes. This technique reduces the number of packets to process, making it extremely effective for large data backups or running a SAN in an internal network.
How to Determine the Optimal MTU with a Single Command
Don’t guess. Use the ping command on Linux with the -M do parameter (prohibit fragmentation) and -s (specify size) to find the network’s “breaking point”.
# Try pinging with a size of 1472 bytes (1472 + 28 bytes header = 1500)
ping -s 1472 -M do 8.8.8.8
If you receive the message Frag needed and DF set, it means 1500 bytes is too large. Gradually decrease the 1472 value (e.g., 1460, 1450…) until the ping succeeds. The optimal MTU will be that number plus 28.
Practical Jumbo Frames Configuration on Linux
To change the MTU immediately for the eth0 interface, use the ip command:
# Set MTU to 9000 for a 10Gbps internal network
sudo ip link set dev eth0 mtu 9000
# Verify the result
ip link show eth0
Extremely Important Note: When enabling Jumbo Frames, every device from the Switch to the Server must be synchronized to 9000. If one link only supports 1500, 9000-byte packets will be dropped entirely, causing a total loss of connectivity.
To make this configuration persistent after a reboot on Ubuntu, edit the Netplan file at /etc/netplan/:
network:
version: 2
ethernets:
eth0:
mtu: 9000
dhcp4: true
Then apply the changes using the command: sudo netplan apply.
MSS Clamping: The Lifesaver for VPNs
Often, you cannot modify the client’s MTU. For example, an employee using WireGuard VPN accesses a server, but the website only loads the title and then hangs. This is where MSS Clamping comes into play. Instead of adjusting each machine, we configure it directly on the Linux Router/Gateway.
It intervenes in the TCP 3-way handshake and forces the MSS size down to a safe level. Use iptables as follows:
# Automatically match MSS to the interface's actual MTU
sudo iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Or force it to 1400 bytes to ensure absolute safety
sudo iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400
This trick solves up to 90% of “endless loading” issues when using a VPN or an ISP’s fiber optic connection.
Real-world Experience: When to Optimize?
After years of infrastructure operations, I’ve distilled three core rules:
- Public Internet: Never increase MTU above 1500. Internet routers will drop your packets immediately. Use MSS Clamping if you are setting up a Gateway.
- Backup/Storage Systems: Enable Jumbo Frames (MTU 9000). In a real-world test, this reduced CPU load from 15% to 5% and increased file copy speeds by about 15%.
- Don’t block ICMP: Ensure your firewall does not block ICMP Type 3 Code 4 packets. If blocked, Linux’s Path MTU Discovery (PMTUD) will fail, causing “Black Hole Router” errors that are very difficult to debug.
Conclusion
There is no single perfect MTU configuration for every scenario. My advice: Keep it at 1500 for the Internet, use 9000 for internal storage, and always have MSS Clamping ready for VPNs. Understanding how packets travel will help you troubleshoot network issues with confidence instead of “searching for a needle in a haystack”.

