Skip to content

Instantly share code, notes, and snippets.

@jsarenik jsarenik/mtu-linux.sh
Last active Jun 28, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.