Generate traffic with a specified throughput
If you don't want to install iperf
(which is not the most reliable tool I've use in the past IMHO), you can use pv
and netcat
You would first need to install pv
and netcat
(it's available in most distro).
On the receiving site you will need a listening socket on a reachable port:
#if you want the output you can remove the redirection or redirect it to a different file.
#if you want to listen to a TCP port below 1024 you will need to use root
nc -l 4444 > /dev/null
On the sending machine you will use this command :
dd if=/dev/urandom bs=1000 count=1000 | pv -L 10M | nc <ip> 4444
dd if=/dev/urandom bs=1000 count=1000
will send blocks of 1000 random characters (1000 Bytes) 1000 time: 1000B * 1000 = 1MB . You can adjust the count to increase the amount of data send.
pv -L 10M
: will limit the write rate to 10 mebibytes/s (*1024).
netcat <ip> 4444
will send the data to the IP on port TCP 4444.
You adapt to send more data or even real file using :
cat /some/files| pv -L 1M | nc <ip> 4444
and on the other side :
nc -l 4444 > /some/destinationfiles