#!/usr/bin/env bash #autoinst-root> cat /etc/rc3.d/S20fulldup #ndd -set /dev/eri instance 0 #ndd -set /dev/eri adv_10hdx_cap 1 #ndd -set /dev/eri adv_10fdx_cap 1 #ndd -set /dev/eri adv_100hdx_cap 0 #ndd -set /dev/eri adv_100fdx_cap 0 #ndd -set /dev/eri adv_autoneg_cap 0 set -u device="" for test_value in eri ce do if ifconfig -a | grep "^${test_value}0" > /dev/null then device="/dev/$test_value" break fi done if [ "$device" = "" ] then echo Sorry, I do not know what kind of ethernet card you have 1>&2 exit 1 else echo Good, we will use device "$device" fi function set_speed { ndd -set "$device" instance 0 case "$speed" in 10) case "$duplex" in fdx) ndd -set "$device" adv_10hdx_cap 0 ndd -set "$device" adv_10fdx_cap 1 ndd -set "$device" adv_100hdx_cap 0 ndd -set "$device" adv_100fdx_cap 0 ndd -set "$device" adv_1000hdx_cap 0 ndd -set "$device" adv_1000fdx_cap 0 ndd -set "$device" adv_autoneg_cap 0 ;; hdx) ndd -set "$device" adv_10hdx_cap 1 ndd -set "$device" adv_10fdx_cap 0 ndd -set "$device" adv_100hdx_cap 0 ndd -set "$device" adv_100fdx_cap 0 ndd -set "$device" adv_1000hdx_cap 0 ndd -set "$device" adv_1000fdx_cap 0 ndd -set "$device" adv_autoneg_cap 0 ;; esac ;; 100) case "$duplex" in fdx) ndd -set "$device" adv_10hdx_cap 0 ndd -set "$device" adv_10fdx_cap 0 ndd -set "$device" adv_100hdx_cap 0 ndd -set "$device" adv_100fdx_cap 1 ndd -set "$device" adv_1000hdx_cap 0 ndd -set "$device" adv_1000fdx_cap 0 ndd -set "$device" adv_autoneg_cap 0 ;; hdx) ndd -set "$device" adv_10hdx_cap 0 ndd -set "$device" adv_10fdx_cap 0 ndd -set "$device" adv_100hdx_cap 1 ndd -set "$device" adv_100fdx_cap 0 ndd -set "$device" adv_1000hdx_cap 0 ndd -set "$device" adv_1000fdx_cap 0 ndd -set "$device" adv_autoneg_cap 0 ;; esac ;; 1000) case "$duplex" in fdx) ndd -set "$device" adv_10hdx_cap 0 ndd -set "$device" adv_10fdx_cap 0 ndd -set "$device" adv_100hdx_cap 0 ndd -set "$device" adv_100fdx_cap 0 ndd -set "$device" adv_1000hdx_cap 0 ndd -set "$device" adv_1000fdx_cap 1 ndd -set "$device" adv_autoneg_cap 0 ;; hdx) ndd -set "$device" adv_10hdx_cap 0 ndd -set "$device" adv_10fdx_cap 0 ndd -set "$device" adv_100hdx_cap 0 ndd -set "$device" adv_100fdx_cap 0 ndd -set "$device" adv_1000hdx_cap 1 ndd -set "$device" adv_1000fdx_cap 0 ndd -set "$device" adv_autoneg_cap 0 ;; esac ;; esac } function ping_test { ping 128.200.34.1 10 > /dev/null 2>&1 } function separate { echo '/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\' echo echo } function pause { sleep 5 } for speed in 10 100 1000 do for duplex in hdx fdx do echo $speed $duplex set_speed partway_decent=false for ping_test_no in 1 2 3 4 5 do pause if ping_test then echo Network is at least minimally usable partway_decent=true break else echo No ping '(yet?)' fi done if [ "$partway_decent" = false ] then echo Giving up on this combo... separate continue fi echo Starting performance test - transfer 1 meg by ssh dd if=/dev/zero bs=1024k count=1 | \ time maxtime 60 ssh root@nsc-1.nacs.uci.edu 'cat > /dev/null' separate done done