#!/bin/sh # Run this to determine your Maximum Transmission Unit (MTU) # # This script isn't bulletproof. Intermittent packet loss can skew # results, for example. It's just a quick-n-dirty kind of thing; # use with intelligence. unset PATH # good security habit ping=/sbin/ping PingSize=1473 # ping adds 28 bytes of overhead PingHost="ns.fastq.com" # replace with your name server, etc. if $ping -c 1 $PingHost >/dev/null 2>&1 ; then echo "$PingHost seems to be alive; proceeding." else echo "Can't ping $PingHost at all. Edit this script and pick another host." exit fi until $ping -D -c 1 -s $PingSize $PingHost >/dev/null 2>&1; do if [ $PingSize -eq 0 ]; then echo echo "No pings went through. Sorry." exit fi PingSize=$(( $PingSize - 1 )) echo -n . done echo if [ $PingSize -eq 1473 ]; then echo "You're using jumbo frames. Edit this script accordingly." else echo "Your MTU is (at least) $(( $PingSize + 28 ))." fi # Copyright (c) 2006 Ben Goren # # Permission to use, copy, modify, and distribute this software # for any purpose with or without fee is hereby granted, provided # that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.