Last active
June 28, 2017 15:31
-
-
Save jsarenik/9ffe0a4578c66929c202d4d0e30e2420 to your computer and use it in GitHub Desktop.
Find MTU on Linux as root.
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/sh -x | |
PL=1500 | |
myping() { | |
ping -c1 -w1 -W1 -nM do -s$1 jasan.tk >/dev/null 2>&1 | |
} | |
until myping $PL; do PL=$(($PL-10)); done | |
while PL=$((PL+2)); myping $PL; do : ; done | |
echo The maximum payload in one packet is $PL | |
# 28 for IP, 8 for ICMP | |
echo MTU is $(($PL+28)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment