For testing internet bandwidth (ie "slow" traffic), you can use tethereal, like that
tethereal eth1 -z conv,tcp
Wait for like 10 seconds, then hit ctrl-c, and you will get statistics about the amount of packets transferred... you might need to add up some numbers, then divide by the capture time
I know... ugly.. but hey, this is linux.
You could use time on the command, but remember that tethereal takes about a couple of seconds to start capturing, so that might not be very efficient.
For faster transfers, tethereal will start dropping packets. (check near the bottom, it says something like 151231 packets dropped if this happens. In this case the bandwidth measurement is not correct.
In this case you might want to use the method below:
For testing "pure" network performance (ie without considering the disk drive performance), you can do that.
Firs you will need a ram filesystem. I am running Knoppix now, so the /tmp/ directory is actually mounted in ram
go to one machine (receiving machine) and type
nc -l -p 12345 > /tmp/bwtest
then on the sending machine
time dd if=/dev/zero | nc 1.1.1.1 12345
(1.1.1.1 being the ip of the receiving machine)
wait for half a minute or so, then hit ctrl-c on the sending machine.
Now you have the time of transfer (real)
You can go on the receiving machine and type
ls -lh /tmp/bwtest
And you will get the amount of data received. Divide that by the time, and you get the bandwidth...
On a 100mbps eth crossover link between 2 machines running knoppix, i got 10 megabytes / second.
All the methods above use tools that are usually bundled with the OS.
Alternatively, there is a linux command line tool called iperf which may also provide bandwidth measurements.