MTU and MSS: Understanding Maximum Transmission Unit and Segment Size
Optimize your network packet sizes. Learn how MTU and MSS affect network performance, what causes fragmentation, how to find optimal values, and fix connectivity issues. Essential for troubleshooting network performance and avoiding packet loss problems.
Quick Overview
MTU (Layer 2/3)
Maximum Transmission Unit - the largest packet size (including headers) that can be transmitted on a network.
- •Standard Ethernet: 1500 bytes
- •Includes IP and protocol headers
- •Set at network interface level
- •Too large causes fragmentation
MSS (Layer 4)
Maximum Segment Size - the largest amount of TCP data (payload only) that can be sent in a single segment.
- •Standard: 1460 bytes (1500 - 40)
- •TCP payload size only
- •Negotiated during TCP handshake
- •Prevents fragmentation
Understanding MTU
MTU defines the maximum size of a complete packet, including all headers and payload. Think of it as the size limit for a shipping container - if your cargo doesn't fit, it must be broken into smaller pieces.
Packet Structure with 1500 Byte MTU
Common MTU Sizes
MTU Across Technologies
- •WiFi: Usually 1500 (same as Ethernet)
- •4G/5G: Varies by carrier (1358-1500)
- •IPv6: Minimum 1280 bytes required
- •Tunnels: Reduced due to encapsulation
Understanding MSS
MSS is specifically for TCP and represents the maximum amount of actual data that can be sent in one TCP segment. MSS = MTU - IP Header (20 bytes) - TCP Header (20 bytes).
MSS Calculation
MSS in TCP Handshake
Packet Fragmentation
When a packet is too large for the network's MTU, it must be fragmented (broken into smaller pieces). Fragmentation causes performance issues and should be avoided.
How Fragmentation Works
Problems with Fragmentation
- ✗Increased CPU overhead on routers
- ✗Higher chance of packet loss
- ✗More bandwidth consumed
- ✗Firewall/security issues
- ✗Reassembly delays
Why Avoid Fragmentation
- ✓MSS prevents TCP fragmentation
- ✓Path MTU Discovery finds optimal size
- ✓MSS clamping fixes mismatches
- ✓Better performance overall
Path MTU Discovery (PMTUD)
Path MTU Discovery is a technique to find the largest MTU size that can be used without fragmentation along the entire path between source and destination.
How PMTUD Works
MSS Clamping
MSS clamping is a technique where routers modify the MSS value in TCP SYN packets to prevent fragmentation. This is commonly used with PPPoE, VPNs, and tunnels.
MSS Clamping in Action
When to Use MSS Clamping
- •PPPoE connections (DSL)
- •VPN tunnels (adds overhead)
- •GRE/IPIP tunnels
- •MPLS networks
- •Any reduced MTU scenario
MSS Clamping Formula
Testing and Finding Optimal MTU
You can test to find the optimal MTU for your connection using ping with specific packet sizes.
Windows MTU Test
- • Success: MTU is good at this size
- • "Packet needs to be fragmented": MTU too large, reduce size
- • Keep reducing by 8-10 bytes until it works
Mac/Linux MTU Test
Common MTU Test Sizes
| Ping Size | Actual MTU | Connection Type |
|---|---|---|
| 1472 | 1500 | Standard Ethernet |
| 1464 | 1492 | PPPoE (DSL) |
| 1422 | 1450 | VPN typical |
| 1372 | 1400 | Some tunnels |
Configuring MTU and MSS
Setting MTU on Different Platforms
Configuring MSS Clamping on Routers
Jumbo Frames
Jumbo frames allow MTU sizes larger than 1500 bytes, typically 9000 bytes. Used in data centers and high-performance networks to reduce overhead and increase throughput.
Advantages
- ✓Higher throughput: Fewer packets for same data
- ✓Lower CPU usage: Less packet processing
- ✓Reduced overhead: Fewer headers
- ✓Better for bulk transfers: Storage, backups
Limitations
- ✗All devices must support: One incompatible device breaks it
- ✗Not for internet: Only internal networks
- ✗Switch/NIC support needed: Hardware must handle 9K frames
- ✗Error retransmission costly: Larger packets to resend
Troubleshooting MTU/MSS Issues
Common Symptoms
Diagnostic Steps
- 1.Test current MTU: Use ping tests to find maximum working packet size
- 2.Check for ICMP blocking: Ensure ICMP "Fragmentation Needed" messages aren't blocked
- 3.Verify MSS values: Capture TCP handshake with Wireshark to see negotiated MSS
- 4.Enable MSS clamping: Configure on router if you control it
- 5.Reduce MTU manually: Set to 1400-1450 on problematic connections