why MTU test results depend on MTU setting on my router??. ex: when I set MTU on my router for 1440, the result is "1440-28=1412", the first MTU gives replay, so how can I know the best MTU??.
-
Please note that MTU is not a property/setting of a router (globally), but the property of a router's interface. It is perfectly acceptable to have MTU1500 on the LAN interface of a router, while the same router's ethernet WAN interface has 1500 too, but the virtual PPP (PPPoE, PPPoA) interface ("on top" of the WAN interface) has an interface MTU of 1492 (because the 8byte PPP header needs to fit into the WAN's 1500bytes, together with the IP packet to be transported).– Marc 'netztier' LuethiCommented Apr 23, 2019 at 14:13
-
Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.– Ron Maupin ♦Commented Dec 15, 2019 at 2:21
1 Answer
When manually setting the MTU on a router (interface), the router is configured to not send larger packets out that interface. Larger packets are either fragmented (if possible) or dropped. The MTU setting is useful when there are further encapsulations behind the router eating into the packet size.
Most ping
implementations use the length parameter for their optional payload size. Since ping uses ICMP echo requests, the packet size equals 20 bytes (IPv4 header) plus 8 bytes (ICMP header) plus the payload size.
You can test a path's MTU with ping using e.g. (Windows) ping -f -l <payloadsize> <destination>
. When <payloadsize>
+28 exceeds the path MTU the ping fails. -f
sets the Don't Fragment flag, like -M do
in many Linux versions (see jonathanjo's comment below).
-
Re "fragmented (if possible)", it's worth noting that most
ping
commands allow control of the DF (don't fragment) IP header flag withping -M do ...
(set DF)ping -M dont ...
(don't set DF), and potentially other options (consult documentation for exact version of ping).` Commented Apr 23, 2019 at 9:22 -
Most ping implementations use the length parameter for their optional payload size.
I have made the experience that the meaning of length varies widely. Some take the given value as payload size, some take the it as the intended full packet size w/IP header, but w/o L2 (or outer encapsulation such as GRE, IPsec etc) headers. I even seem to remember that in one case, "length" meant payload+icmp header, but not the IP header. Of course, the ones who programmed some ping output routines ("received n bytes from <ip>") had other ideas, too. It's a continuous game of +8, +20, -20, -8. Commented Apr 23, 2019 at 14:08 -
@Marc'netztier'Luethi Absolutely - but I've found that most implementations do use the payload size as parameter.– Zac67 ♦Commented Apr 23, 2019 at 17:04