2

I noticed kind of strange behaviour and my knowledge doesn't have answer for it. So I want to know MTU. First ping:

ping -c 1 -s 1800 -M do google.com
PING google.com (216.58.209.14) 1800(1828) bytes of data.
ping: local error: Message too long, mtu=1500

--- google.com ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

So I conclude that MTU is 1500. But after sending 1472 bytes I get:

ping -c 1 -s 1472 -M do google.com
PING google.com (216.58.209.14) 1472(1500) bytes of data.
From 192.168.55.1 (192.168.55.1) icmp_seq=1 Frag needed and DF set (mtu = 0)

--- google.com ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

And then:

ping -c 1 -s 1500 -M do google.com
PING google.com (216.58.209.14) 1500(1528) bytes of data.
ping: local error: Message too long, mtu=552

--- google.com ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

Why it changed?

Nerwena
  • 23
  • 2

1 Answers1

1

-M do sets the Don't fragment bit (DF), so you can only successfully ping when not exceeding the path MTU.

-s 1472 for a total packet size of 1500 is the largest ping payload that works over plain Ethernet. Protocols like PPPoE eat into that, so a router in the path reports MTU exceeded and there's no echo reply.

You cannot even locally send -s 1500 without fragmention since -s specifies the optional payload for the ICMP echo request. The IP packet header is 20 bytes, the ICMP header 8 bytes, so 1472 bytes is the largest ping payload for plain Ethernet.

Zac67
  • 84,333
  • 4
  • 69
  • 133