Sub topic 14
Finding the path MTU with ping
This chapter assumes you can run ping and read its replies, and that you know packets cross routers to reach a destination. It uses the Windows commands from the Topic Spine and adds Linux and macOS equivalents.
What path MTU means
The maximum transmission unit (MTU) is the largest IP packet a link can carry without splitting it. Ethernet usually allows 1500 bytes. The path MTU is the smallest MTU of any link between you and the destination. A tunnel, VPN, or PPPoE connection often lowers it, because the tunnel adds its own headers.
A packet larger than a link's MTU must be fragmented, or dropped if its Don't Fragment (DF) bit is set. A router that drops it should send back an ICMP "Fragmentation needed" message. Some networks filter that message, so large transfers stall while small ones, such as ping, still work.
How the ping test works
Ping lets you set the payload size and the DF bit. If the packet cannot fit, it fails instead of being fragmented. The total packet size is:
- the payload you choose
- plus 8 bytes of ICMP header
- plus 20 bytes of IPv4 header
That is 28 bytes of overhead. To test a 1500-byte packet, send a 1472-byte payload.
ping -f -l 1472 8.8.8.8Here -f sets the Don't Fragment bit and -l sets the payload size in bytes.
Reading the results
| Result | Meaning |
|---|---|
| Normal replies | A 1500-byte packet crosses the whole path. |
| `Packet needs to be fragmented but DF set.` | A link on the path has a smaller MTU. |
| `Request timed out.` | The packet was dropped silently, or ICMP is filtered. Be careful: this does not prove an MTU problem. |
Finding the limit
Lower the payload until replies return. The largest payload that succeeds plus 28 is the path MTU.
ping -f -l 1472 8.8.8.8
ping -f -l 1464 8.8.8.8
ping -f -l 1452 8.8.8.8
ping -f -l 1400 8.8.8.8Suppose 1472 and 1464 fail but 1452 succeeds. Test values between 1453 and 1463 until you find the largest one that works. If that value is 1452, the path MTU is 1452 + 28 = 1480.
Linux and macOS
Linux uses -M do to forbid fragmentation and -s for the payload size. macOS uses -D for the DF bit and -s for the size.
ping -M do -s 1472 -c 4 8.8.8.8ping -D -s 1472 -c 4 8.8.8.8The first command is for Linux and the second is for macOS.
Exercise
You run ping -f -l 1472 8.8.8.8 and get "Packet needs to be fragmented but DF set." The largest payload that succeeds is 1412 bytes. What is the path MTU?
Show answer
1440 bytes. The path MTU is the largest working payload plus 28 bytes of ICMP and IPv4 headers: 1412 + 28 = 1440.
Exercise
Why does a "Request timed out." result not prove that an MTU problem exists?
Show answer
A timeout can also come from a firewall that drops ICMP, from a router that rate limits it, or from an unreachable host. Only the "Packet needs to be fragmented but DF set." message points directly to an MTU limit.