#!/bin/sh # # version 1.0, 2000/07/07, mwang@mindspring.com # # To install: # # cp network /etc/init.d/network # ln /etc/init.d/network /etc/rc2.d/S99network PATH=/usr/bin:/usr/sbin [ "$RANDOM" = "$RANDOM" ] && exec ksh "$0" "$@" interface="hme:0 qfe:0 qfe:1 qfe:2" case "$1" in start) echo "I am forcing 100MBit/s, FULL duplex. Please wait for a few minutes." # output appears after ndd, need unbuffered echo? for i in $interface do int=${i%:*} ins=${i#*:} ndd -set /dev/$int instance $ins ndd -set /dev/$int adv_100T4_cap 0 ndd -set /dev/$int adv_100fdx_cap 1 ndd -set /dev/$int adv_100hdx_cap 0 ndd -set /dev/$int adv_10fdx_cap 0 ndd -set /dev/$int adv_10hdx_cap 0 ndd -set /dev/$int adv_autoneg_cap 0 done ;; stop) ;; stat|status) for i in $interface do int=${i%:*} ins=${i#*:} ndd -set /dev/$int instance $ins echo "for network interface $i -" j=$(ndd -get /dev/$int link_speed) if (( $j == 1 )); then echo " It is operating at 100MBit/s, good." elif (( $j == 0 )); then echo " It is operating at 10MBit/s, that is not good." else echo " I can not find what speed it is operating at." fi j=$(ndd -get /dev/$int link_mode) if (( $j == 1 )); then echo " It is operating in full duplex, good." elif (( $j == 0 )); then echo " It is operating in half duplex, that is not good." else echo " I can not find what duplex it is operating in." fi done ;; *) echo "usage: sh /etc/init.d/network {start|stop|stat|status}" ;; esac