On 08 Oct 2002 22:02:44 -0300
Toshiro <[EMAIL PROTECTED]> wrote:
> I've asked several times this question before, but nobody gave me a good
> answer so far, let me try here :)
>
> What shall I do to know the actual connection speed (10/100Mb) of a
> network interface? I'm looking for a linux software solution (like
> typing a command, looking at some log, you name it), answers like "look
> at the link light of your network card/switch/etc" are not valid :)
>
> BTW, in Solaris is pretty simple to know that, just bring the interface
> up with 'ifconf' and you get the answer.
>
> Toshiro.
>
>
>
i wrote this little script for me...
#!/bin/bash
# xspeed
# jipe-2002
case $2 in
xspeed)
Xsp=$(/sbin/ifconfig $1 | grep "RX bytes" | awk '{ print $2" "$6}')
aR=$(echo $Xsp | awk '{ print $1}' | tr -d "bytes:")
aT=$(echo $Xsp | awk '{ print $2}' | tr -d "bytes:")
T=$(date "+%s")
b=135
while true
do
a=0
while [ $a -lt 100 ]
do
a=$((a+1))
clear
Xsp=$(/sbin/ifconfig $1 | grep "RX bytes" |
awk '{ print $2" "$6}')
aR1=$(echo $Xsp | awk '{ print $1}' | tr -d
"bytes:")
aT1=$(echo $Xsp | awk '{ print $2}' | tr -d
"bytes:")
ar=$(((aR1-aR)*100/$b))
at=$(((aT1-aT)*100/$b))
echo -e "R speed :\t$ar bytes/s\nT speed
:\t$at bytes/s"
echo -e "time adj:\t$b"
aR=$aR1
aT=$aT1
if [ $a == 100 ]
then
b=$(($(date "+%s")-T))
T=$(date "+%s")
fi
sleep 1
done
done
;;
*)
xterm -geometry 30x4-0-0 -title "$0 $1" -exec $0 $1 xspeed
;;
esac
to launch it:
$ xspeed <interface>
interface is like eth0 or ppp0
what it does:
1) reads the output of /sbin/ifconfig <interface> then sleep 1 second
2) compares with the last output
3) adjusts time
4) outputs the results in a little xterm window on the left lower hand corner of the
screen
it is nor really precise, neither very sophisticated, but it is usefull on my old PII
333...
bye
jipe
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com