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))"
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 22.214.171.124