I find one shell command can send large data to target host:
dd if=/dev/zero bs=4096 count=1048576 | ssh user@ip 'cat > /dev/null'
I think i can use this to test network bandwidth, but it can not display the process status.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Well if you wrap this whole thing in
time sh -c "dd if=/dev/zero bs=4096 count=1048576 | ssh user@ip 'cat > /dev/null'"
that will give give you the time it takes the transfer to complete. Divide the bytes transferred by the time and that's your throughput.
For a progress meter, you can use pv, which eliminates the need to use time(1):
dd if=/dev/zero bs=1024 count=10000 | pv --size 10240000 | ssh user@ip 'cat > /dev/null'
which will give you a nice progress meter, especially if you load the
--size argument with the total size of the transfer.
If what you want to do is test network bandwidth, there are more direct ways of doing so.
ttcp or its replacement:
[tla ~]$ nuttcp -S michael@challenger:~$ nuttcp -4 -r tla 41.5574 MB / 10.46 sec = 33.3336 Mbps 2 %TX 4 %RX michael@challenger:~$ nuttcp -4 -t tla 15.4347 MB / 10.13 sec = 12.7821 Mbps 1 %TX 2 %RX 0 retrans 3.30 msRTT
you can use iperf if you really want to test connectivity with great detail.
Create a 100mb test file
dd if=/dev/urandom of=./test.bin bs=1024000 count=100
then scp this file to test upload performance
scp test.bin x.x.x.x:.
or scp from the far side to test your download performance
Usually better to use iperf to test bandwidth, beacuse it has no encryption overhead, but you can insert pv between dd and ssh to see transfer speed in real-time:
dd if=/dev/random | pv | ssh somehost 'cat > /dev/null'
Also, on FreeBSD you can send SIGINFO to dd by hitting Ctrl+T, after that some stats (including speed) will be displayed