Last active
September 28, 2022 19:42
-
-
Save rs-development/1d44482c019dc2a3a545c640b3bba27d to your computer and use it in GitHub Desktop.
Maximum MTU check script - Call with target address as first argument
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check your maximum MTU size with the help of ping | |
if [ -z "$1" ] | |
then | |
echo "Using 1.1.1.1 as default target, provide your own as argument" | |
HOSTNAME="1.1.1.1" | |
else | |
HOSTNAME=$1 | |
fi | |
PKT_SIZE=1500 | |
ping -M do -c 1 -W 1 -s $PKT_SIZE $HOSTNAME > /dev/null | |
r=$? | |
#echo $r | |
while [ $r -eq 1 ]; do | |
PKT_SIZE=$(($PKT_SIZE - 10)) | |
echo "Testing MTU:" $PKT_SIZE | |
ping -M do -c 1 -W 1 -s $PKT_SIZE $HOSTNAME > /dev/null | |
r=$? | |
#echo $r | |
done | |
printf "Your Maximum MTU is [ $((PKT_SIZE + 28)) ] \n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment