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?

0

4 Answers 4

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))"
0
3

Here's a very simple solution:

ping -s 4024 192.168.0.3

Where -s determines the size of the packet being sent

1

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:

https://github.com/iputils/iputils/issues/320

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!

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .