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 ?


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:

while ping -s $size -c1 -M do google.com >&/dev/null; do 
echo "Max MTU size: $((size-4+28))"
| improve this answer | |

Here's a very simple solution:

ping -s 4024

Where -s determines the size of the packet being sent

| improve this answer | |

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