Iperf多个stream

我需要使用iperf在两个站点之间testing我的networking。 我想打开并行stream发送不同的数据(比如5个定义的端口),随机的长度从10-1000,每3秒传输一次,间隔1-2秒。 分组速率也应该是1000pps。 我试图写一些shell脚本,但他们没有工作。 感谢您的帮助!

#/bin/sh while : do $time=$(($RANDOM%3+1)) #time when packets are sent (1-3s) $pause=$(($RANDOM%2+1)) #time when we stop sending packets (1-2s) $length=$(($RANDOM%991+10)) #length of packet (10-1000bytes) iperf -c 10.0.0.1 -p 21 -l $length -t $time -n 1000 # I'm not sure if -n 1000 means 1000pps? ### (here goes another iperfs but with different ports) ### sleep $pause done 

如果每个iperf都有不同的$ time和$ pause time,multithreading会更好?

PS我尝试更换思科TGN(Traffic GeNerator)工具。 我介绍下面我试图replace的代码(也许会对某人有所帮助):

 Router#tgn fastethernet 0/0 add tcp rate 1000 L2-dest aaaa.bbbb.cccc L3-src source_ip_address L3-dest destination_ip_address L4-dest 23 length random 16 to 1500 burst on burst duration off 1000 to 2000 burst duration on 1000 to 3000 add fastethernet0/0 1 l4-dest 80 add fastethernet0/0 1 l4-dest 21 add fastethernet0/0 1 l4-dest 123 add fastethernet0/0 1 l4-dest 110 add fastethernet0/0 1 l4-dest 25 add fastethernet0/0 1 l4-dest 22 add fastethernet0/0 1 l4-dest 6000