8

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 ?

6

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 -s option.

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))"
| improve this answer | |
3

Here's a very simple solution:

ping -s 4024 192.168.0.3

Where -s determines the size of the packet being sent

| improve this answer | |
0

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 131.107.8.1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.