Skip to content

Instantly share code, notes, and snippets.

@jsarenik
Last active June 28, 2017 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsarenik/9ffe0a4578c66929c202d4d0e30e2420 to your computer and use it in GitHub Desktop.
Save jsarenik/9ffe0a4578c66929c202d4d0e30e2420 to your computer and use it in GitHub Desktop.
Find MTU on Linux as root.
#!/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