I would like to change the default size of my ping, to be able to test the MTU on my link.
How can I do that?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
To test the maximum MTU size on a link (i.e. to test for ICMP fragmentation) you can set the
ping packet size using the
For example, to find the maximum MTU you can loop over increasing packet sizes until
ping returns an error code:
size=1272 while ping -s $size -c1 -M do google.com >&/dev/null; do ((size+=4)) done echo "Max MTU size: $((size-4+28))"
Here's a very simple solution: ping -s 4024 192.168.0.3 Where -s determines the size of the packet being sent
The suggestions above won't work anymore on any modern Debian based linux systems due to iputils quietly breaking:
If the ICMP echo reply gets truncated to MTU size (or anything other than what you sent in the ICMP echo request packet), ping will print nothing!
On Windows OS, the
-l parameter allows to change the size of the icmp packet (the default size is 32 bytes). According to Microsoft
Here's an example of a
ping with 1450 bytes of data:
ping -l 1450 220.127.116.11