前一段时间写了一篇关于打流的简单笔记,包含脚本的简单编写,见

一次打流过程的优化反思(iperf3的灵活运用)_sixtome-CSDN博客_iperf3 打流

这几天在实际应用中,发现还是有不少的瑕疵,根据实际情况又进行了思考,在实用性方面进行了部分优化,首先这个是一个最基础的脚本。

root@fetmx6ull-s:~# cat tc1.sh
#!/bin/bash
ifconfig eth0 192.168.0.232 up
ifconfig
sleep 1s
while true
do
iperf3 -c 192.168.0.9 -i 1 -t10
sleep 1s
done

由于iperf3的实际使用中,在server端和client端反应有些不同,有可能需要同时监测,可以使用如下脚本

#!/bin/bash
ifconfig eth0 192.168.0.232 up
ifconfig
sleep 1s
while true
do
iperf3 -c 192.168.0.9 -i 1 -t10
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t 10 -R
sleep 1s
done

这样,打流10次后改变方式,从sever端发起数据,查看反方向的数据情况;执行后如下

有些时候不仅要检验TCP的数据,还要查看udp的数据情况,那么就需要增加udp的打流过程,如下:

root@fetmx6ull-s:~# cat tc1.sh
#!/bin/bash
ifconfig eth0 192.168.0.232 up
ifconfig
sleep 1s
while true
do
iperf3 -c 192.168.0.9 -i 1 -t10
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t 10 -R
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t 10 -u -b 10M
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t 10 -u -b 10M -R
sleep 1sdone

执行后效果如下:

root@fetmx6ull-s:~# ./tc1.sh
eth0      Link encap:Ethernet  HWaddr AA:CC:DD:EE:FF:DD  inet addr:192.168.0.232  Bcast:192.168.0.255  Mask:255.255.255.0inet6 addr: fe80::a8cc:ddff:feee:ffdd%1995478736/64 Scope:LinkUP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:23529953 errors:0 dropped:0 overruns:0 frame:0TX packets:3765850 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:1864130622 (1.7 GiB)  TX bytes:3808531536 (3.5 GiB)lo        Link encap:Local Loopback  inet addr:127.0.0.1  Mask:255.0.0.0inet6 addr: ::1%1995478736/128 Scope:HostUP LOOPBACK RUNNING  MTU:65536  Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0 RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)Connecting to host 192.168.0.9, port 5201
[  4] local 192.168.0.232 port 35969 connected to 192.168.0.9 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  11.8 MBytes  99.3 Mbits/sec    0    221 KBytes
[  4]   1.00-2.00   sec  11.3 MBytes  94.6 Mbits/sec    0    221 KBytes
[  4]   2.00-3.00   sec  11.0 MBytes  92.5 Mbits/sec    0    221 KBytes
[  4]   3.00-4.00   sec  11.3 MBytes  94.6 Mbits/sec    0    221 KBytes
[  4]   4.00-5.00   sec  11.3 MBytes  94.6 Mbits/sec    0    221 KBytes
[  4]   5.00-6.00   sec  11.3 MBytes  94.6 Mbits/sec    0    221 KBytes
[  4]   6.00-7.00   sec  11.0 MBytes  92.5 Mbits/sec    0    221 KBytes
[  4]   7.00-8.00   sec  11.3 MBytes  94.6 Mbits/sec    0    221 KBytes
[  4]   8.00-9.00   sec  11.3 MBytes  94.5 Mbits/sec    0    221 KBytes
[  4]   9.00-10.00  sec  11.3 MBytes  94.6 Mbits/sec    0    221 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   113 MBytes  94.6 Mbits/sec    0             sender
[  4]   0.00-10.00  sec   112 MBytes  94.2 Mbits/sec                  receiveriperf Done.
Connecting to host 192.168.0.9, port 5201
Reverse mode, remote host 192.168.0.9 is sending
[  4] local 192.168.0.232 port 35971 connected to 192.168.0.9 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  11.4 MBytes  95.9 Mbits/sec
[  4]   1.00-2.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   2.00-3.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   3.00-4.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   4.00-5.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   5.00-6.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   6.00-7.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   7.00-8.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   8.00-9.00   sec  11.3 MBytes  94.9 Mbits/sec
[  4]   9.00-10.00  sec  11.3 MBytes  94.9 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec   114 MBytes  95.9 Mbits/sec                  sender
[  4]   0.00-10.00  sec   114 MBytes  95.7 Mbits/sec                  receiveriperf Done.
Connecting to host 192.168.0.9, port 5201
[  4] local 192.168.0.232 port 53389 connected to 192.168.0.9 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  1.09 MBytes  9.11 Mbits/sec  139
[  4]   1.00-2.00   sec  1.19 MBytes  9.96 Mbits/sec  152
[  4]   2.00-3.00   sec  1.20 MBytes  10.0 Mbits/sec  153
[  4]   3.00-4.00   sec  1.20 MBytes  10.0 Mbits/sec  153
[  4]   4.00-5.00   sec  1.19 MBytes  9.96 Mbits/sec  152
[  4]   5.00-6.00   sec  1.20 MBytes  10.0 Mbits/sec  153
[  4]   6.00-7.00   sec  1.19 MBytes  9.96 Mbits/sec  152
[  4]   7.00-8.00   sec  1.20 MBytes  10.0 Mbits/sec  153
[  4]   8.00-9.00   sec  1.19 MBytes  9.96 Mbits/sec  152
[  4]   9.00-10.00  sec  1.20 MBytes  10.0 Mbits/sec  153
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec  11.8 MBytes  9.91 Mbits/sec  0.421 ms  0/1512 (0%)
[  4] Sent 1512 datagramsiperf Done.
Connecting to host 192.168.0.9, port 5201
Reverse mode, remote host 192.168.0.9 is sending
[  4] local 192.168.0.232 port 60697 connected to 192.168.0.9 port 5201
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-1.00   sec  1.22 MBytes  10.2 Mbits/sec  67574.222 ms  0/156 (0%)
[  4]   1.00-2.00   sec  1.19 MBytes  9.96 Mbits/sec  4.265 ms  0/152 (0%)
[  4]   2.00-3.00   sec  1.18 MBytes  9.90 Mbits/sec  0.611 ms  0/151 (0%)
[  4]   3.00-4.00   sec  1.20 MBytes  10.0 Mbits/sec  0.618 ms  0/153 (0%)
[  4]   4.00-5.00   sec  1.19 MBytes  9.96 Mbits/sec  0.644 ms  0/152 (0%)
[  4]   5.00-6.00   sec  1.20 MBytes  10.0 Mbits/sec  0.610 ms  0/153 (0%)
[  4]   6.00-7.00   sec  1.20 MBytes  10.0 Mbits/sec  0.628 ms  0/153 (0%)
[  4]   7.00-8.00   sec  1.19 MBytes  9.96 Mbits/sec  0.622 ms  0/152 (0%)
[  4]   8.00-9.00   sec  1.20 MBytes  10.0 Mbits/sec  0.643 ms  0/153 (0%)
[  4]   9.00-10.00  sec  1.20 MBytes  10.0 Mbits/sec  0.586 ms  0/153 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec  11.9 MBytes  10.0 Mbits/sec  0.586 ms  0/1528 (0%)
[  4] Sent 1528 datagramsiperf Done.

有些时候,还需要对多个网卡进行同时打流的实验,脚本可如下:

由于同时打流,就要占用多个端口,需要在另外一块开发板或者电脑上先开辟多个端口

iperf3 -s -p 5000

iperf3 -s -p 5001

iperf3 -s -p 5002

iperf3 -s -p 5003

编写脚本如下:

root@fetmx6ull-s:~# cat tc1.sh
#!/bin/bash
ifconfig eth0 192.168.0.232 up
ifconfig
sleep 1s
while true
do
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5000
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5001
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5002
sleep 1s
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5003
sleep 1sdone

我这里的脚本都使用的一个ip 192.168.0.9 ,真正使用的时候,需要修改成不同的ip地址,执行的时候,可以从服务端上看到4个ip(端口)轮询打流。客户端效果如下:


Connecting to host 192.168.0.9, port 5000
[  4] local 192.168.0.232 port 35667 connected to 192.168.0.9 port 5000
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  11.7 MBytes  98.2 Mbits/sec    0    210 KBytes
[  4]   1.00-2.00   sec  11.5 MBytes  96.6 Mbits/sec    0    210 KBytes
[  4]   2.00-3.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   3.00-4.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   4.00-5.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   5.00-6.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   6.00-7.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   7.00-8.00   sec  11.5 MBytes  96.6 Mbits/sec    0    210 KBytes
[  4]   8.00-9.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   9.00-10.00  sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   114 MBytes  95.3 Mbits/sec    0             sender
[  4]   0.00-10.00  sec   113 MBytes  95.0 Mbits/sec                  receiveriperf Done.
Connecting to host 192.168.0.9, port 5001
[  4] local 192.168.0.232 port 51208 connected to 192.168.0.9 port 5001
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  11.8 MBytes  98.7 Mbits/sec    0    242 KBytes
[  4]   1.00-2.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   2.00-3.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   3.00-4.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   4.00-5.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   5.00-6.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   6.00-7.00   sec  11.3 MBytes  94.6 Mbits/sec    0    242 KBytes
[  4]   7.00-8.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   8.00-9.00   sec  11.3 MBytes  95.1 Mbits/sec    0    242 KBytes
[  4]   9.00-10.00  sec  11.3 MBytes  94.6 Mbits/sec    0    242 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   114 MBytes  95.3 Mbits/sec    0             sender
[  4]   0.00-10.00  sec   113 MBytes  94.9 Mbits/sec                  receiveriperf Done.
Connecting to host 192.168.0.9, port 5002
[  4] local 192.168.0.232 port 48166 connected to 192.168.0.9 port 5002
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  11.8 MBytes  99.2 Mbits/sec    0    244 KBytes
[  4]   1.00-2.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   2.00-3.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   3.00-4.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   4.00-5.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   5.00-6.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   6.00-7.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   7.00-8.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   8.00-9.00   sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
[  4]   9.00-10.00  sec  11.3 MBytes  95.1 Mbits/sec    0    244 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   114 MBytes  95.5 Mbits/sec    0             sender
[  4]   0.00-10.00  sec   113 MBytes  95.0 Mbits/sec                  receiveriperf Done.
Connecting to host 192.168.0.9, port 5003
[  4] local 192.168.0.232 port 51305 connected to 192.168.0.9 port 5003
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  11.9 MBytes  99.7 Mbits/sec    0    210 KBytes
[  4]   1.00-2.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   2.00-3.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   3.00-4.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   4.00-5.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   5.00-6.00   sec  11.5 MBytes  96.6 Mbits/sec    0    210 KBytes
[  4]   6.00-7.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   7.00-8.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   8.00-9.00   sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
[  4]   9.00-10.00  sec  11.3 MBytes  94.6 Mbits/sec    0    210 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   114 MBytes  95.3 Mbits/sec    0             sender

这样,我们看到虽然可以实现多个打流,但是还不是同时的效果,那么我们如何实现同时打流呢,可以将脚本修成成如下:

root@fetmx6ull-s:~# cat tc1.sh
#!/bin/bash
ifconfig eth0 192.168.0.232 up
ifconfig
sleep 1s
while true
do
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5000 &
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5001 &
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5002 &
iperf3 -c 192.168.0.9 -i 1 -t10 -p 5003 &
sleep 11s
done

让打流的iperf3的后台运行,这样就不用等上一个iperf3运行完,可以达到同时打流的目的。

执行如下:

root@fetmx6ull-s:~# ./tc1.sh &
[1] 1805
root@fetmx6ull-s:~# eth0      Link encap:Ethernet  HWaddr AA:CC:DD:EE:FF:DD  inet addr:192.168.0.232  Bcast:192.168.0.255  Mask:255.255.255.0inet6 addr: fe80::a8cc:ddff:feee:ffdd%1996404432/64 Scope:LinkUP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:24314679 errors:0 dropped:0 overruns:0 frame:0TX packets:3932241 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:2089994851 (1.9 GiB)  TX bytes:1474977594 (1.3 GiB)lo        Link encap:Local Loopback  inet addr:127.0.0.1  Mask:255.0.0.0inet6 addr: ::1%1996404432/128 Scope:HostUP LOOPBACK RUNNING  MTU:65536  Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0 RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)Connecting to host 192.168.0.9, port 5003
Connecting to host 192.168.0.9, port 5001
Connecting to host 192.168.0.9, port 5002
Connecting to host 192.168.0.9, port 5000
[  4] local 192.168.0.232 port 51328 connected to 192.168.0.9 port 5003
[  4] local 192.168.0.232 port 51237 connected to 192.168.0.9 port 5001
[  4] local 192.168.0.232 port 35699 connected to 192.168.0.9 port 5000
[  4] local 192.168.0.232 port 48192 connected to 192.168.0.9 port 5002
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  2.35 MBytes  19.7 Mbits/sec    0   45.6 KBytes
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  4.20 MBytes  35.2 Mbits/sec    0   98.4 KBytes
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  1.02 MBytes  8.54 Mbits/sec    0   25.7 KBytes
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  4.75 MBytes  39.8 Mbits/sec    0    106 KBytes
[  4]   1.00-2.00   sec  1.65 MBytes  13.9 Mbits/sec    0   45.6 KBytes
[  4]   1.00-2.00   sec  3.68 MBytes  30.8 Mbits/sec    0   98.4 KBytes
[  4]   1.00-2.00   sec   863 KBytes  7.07 Mbits/sec    0   25.7 KBytes
[  4]   1.00-2.00   sec  5.21 MBytes  43.6 Mbits/sec    0    121 KBytes
[  4]   2.00-3.00   sec  1.47 MBytes  12.3 Mbits/sec    0   45.6 KBytes
[  4]   2.00-3.00   sec  3.43 MBytes  28.8 Mbits/sec    0   98.4 KBytes
[  4]   2.00-3.00   sec   898 KBytes  7.36 Mbits/sec    0   25.7 KBytes
[  4]   2.00-3.00   sec  5.51 MBytes  46.3 Mbits/sec    0    133 KBytes
[  4]   3.00-4.00   sec  1.72 MBytes  14.4 Mbits/sec    0   45.6 KBytes
[  4]   3.00-4.00   sec  3.68 MBytes  30.8 Mbits/sec    0   98.4 KBytes
[  4]   3.00-4.00   sec   927 KBytes  7.59 Mbits/sec    0   25.7 KBytes
[  4]   3.00-4.00   sec  5.15 MBytes  43.2 Mbits/sec    0    133 KBytes
[  4]   4.00-5.00   sec  1.72 MBytes  14.4 Mbits/sec    0   45.6 KBytes
[  4]   4.00-5.00   sec  3.55 MBytes  29.8 Mbits/sec    0   98.4 KBytes
[  4]   4.00-5.00   sec   890 KBytes  7.29 Mbits/sec    0   25.7 KBytes
[  4]   4.00-5.00   sec  5.15 MBytes  43.2 Mbits/sec    0    133 KBytes
[  4]   5.00-6.00   sec  1.60 MBytes  13.4 Mbits/sec    0   45.6 KBytes
[  4]   5.00-6.00   sec  3.80 MBytes  31.9 Mbits/sec    0   98.4 KBytes
[  4]   5.00-6.00   sec   780 KBytes  6.39 Mbits/sec    0   25.7 KBytes
[  4]   5.00-6.00   sec  5.15 MBytes  43.2 Mbits/sec    0    133 KBytes
[  4]   6.00-7.00   sec  1.59 MBytes  13.4 Mbits/sec    0   45.6 KBytes
[  4]   6.00-7.00   sec  3.43 MBytes  28.8 Mbits/sec    0   98.4 KBytes
[  4]   6.00-7.00   sec   893 KBytes  7.31 Mbits/sec    0   25.7 KBytes
[  4]   6.00-7.00   sec  5.51 MBytes  46.3 Mbits/sec    0    133 KBytes
[  4]   7.00-8.00   sec  2.28 MBytes  19.1 Mbits/sec    0   71.3 KBytes
[  4]   7.00-8.00   sec  3.06 MBytes  25.7 Mbits/sec    0   98.4 KBytes
[  4]   7.00-8.00   sec   740 KBytes  6.06 Mbits/sec    0   25.7 KBytes
[  4]   7.00-8.00   sec  5.39 MBytes  45.2 Mbits/sec    0    187 KBytes
[  4]   8.00-9.00   sec  2.21 MBytes  18.5 Mbits/sec    0   71.3 KBytes
[  4]   8.00-9.00   sec  2.94 MBytes  24.7 Mbits/sec    0   98.4 KBytes
[  4]   8.00-9.00   sec   545 KBytes  4.46 Mbits/sec    0   25.7 KBytes
[  4]   8.00-9.00   sec  5.64 MBytes  47.3 Mbits/sec    0    187 KBytes
[  4]   9.00-10.00  sec  2.08 MBytes  17.5 Mbits/sec    0   71.3 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  18.7 MBytes  15.7 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  18.5 MBytes  15.5 Mbits/sec                  receiveriperf Done.
[  4]   9.00-10.00  sec   602 KBytes  4.93 Mbits/sec    0   25.7 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  7.99 MBytes  6.70 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  7.89 MBytes  6.62 Mbits/sec                  receiveriperf Done.
[  4]   9.00-10.00  sec  3.06 MBytes  25.7 Mbits/sec    0   98.4 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  34.8 MBytes  29.2 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  34.7 MBytes  29.1 Mbits/sec                  receiveriperf Done.
[  4]   9.00-10.00  sec  5.64 MBytes  47.3 Mbits/sec    0    187 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  53.1 MBytes  44.5 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  52.6 MBytes  44.1 Mbits/sec                  receiveriperf Done.

我们可以看到,4个打流进程在同步运行。

注意:

1)由于是同时打流,有可能带宽会有有写变化,这个不同的平台可能数据变化不一。

2) 后面的sleep 11s 的数据,一定不要小于10s,因为每一次的打流参数是t10,就需要10s的时间,小于10s会出错的。

3)同时打流发现数据是乱的。比如

上面这4行,那个分别对应端口号5000,5001,5002,5003呢,分不清了。总不能猜吧?还有如果有一个网络异常,那么会有一个是报错的,但是我们如何知道是那一个出错了呢?也许你会说,看网口的灯,但是如果在做实验的时候,环境下是看不到网口的灯的情况呢?

OK,这个时候我们就要用到 -T 参数,这个也是好多人不知道的了,将上面的脚本修改下,如图

我们看到 -T 后面跟的是对应的端口名称,这样就相当于增加了一个备注功能,执行后效果如下:

5003:  Connecting to host 192.168.0.9, port 5003
5001:  Connecting to host 192.168.0.9, port 5001
5002:  Connecting to host 192.168.0.9, port 5002
5000:  Connecting to host 192.168.0.9, port 5000
5003:  [  4] local 192.168.0.232 port 51368 connected to 192.168.0.9 port 5003
5001:  [  4] local 192.168.0.232 port 51276 connected to 192.168.0.9 port 5001
5002:  [  4] local 192.168.0.232 port 48233 connected to 192.168.0.9 port 5002
5000:  [  4] local 192.168.0.232 port 35739 connected to 192.168.0.9 port 5000
5003:  [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
5003:  [  4]   0.00-1.00   sec  1.83 MBytes  15.3 Mbits/sec    0   34.2 KBytes
5001:  [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
5001:  [  4]   0.00-1.00   sec  1.71 MBytes  14.4 Mbits/sec    0   32.8 KBytes
5002:  [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
5002:  [  4]   0.00-1.00   sec  1.73 MBytes  14.5 Mbits/sec    0   31.4 KBytes
5000:  [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
5000:  [  4]   0.00-1.00   sec  6.84 MBytes  57.4 Mbits/sec    0    138 KBytes
5003:  [  4]   1.00-2.00   sec  1.49 MBytes  12.5 Mbits/sec    0   34.2 KBytes
5001:  [  4]   1.00-2.00   sec  1.43 MBytes  12.0 Mbits/sec    0   32.8 KBytes
5002:  [  4]   1.00-2.00   sec  1.40 MBytes  11.7 Mbits/sec    0   32.8 KBytes
5000:  [  4]   1.00-2.00   sec  6.98 MBytes  58.6 Mbits/sec    0    138 KBytes
5003:  [  4]   2.00-3.00   sec  1.69 MBytes  14.2 Mbits/sec    0   37.1 KBytes
5001:  [  4]   2.00-3.00   sec  1.65 MBytes  13.9 Mbits/sec    0   35.6 KBytes
5002:  [  4]   2.00-3.00   sec  1.62 MBytes  13.6 Mbits/sec    0   37.1 KBytes
5000:  [  4]   2.00-3.00   sec  6.43 MBytes  54.0 Mbits/sec    0    138 KBytes
5003:  [  4]   3.00-4.00   sec  1.62 MBytes  13.6 Mbits/sec    0   37.1 KBytes
5001:  [  4]   3.00-4.00   sec  1.74 MBytes  14.6 Mbits/sec    0   41.3 KBytes
5002:  [  4]   3.00-4.00   sec  1.63 MBytes  13.7 Mbits/sec    0   37.1 KBytes
5000:  [  4]   3.00-4.00   sec  6.25 MBytes  52.4 Mbits/sec    0    144 KBytes
5003:  [  4]   4.00-5.00   sec  1.48 MBytes  12.4 Mbits/sec    0   37.1 KBytes
5001:  [  4]   4.00-5.00   sec  1.91 MBytes  16.0 Mbits/sec    0   51.3 KBytes
5002:  [  4]   4.00-5.00   sec  1.58 MBytes  13.3 Mbits/sec    0   37.1 KBytes
5000:  [  4]   4.00-5.00   sec  6.43 MBytes  54.0 Mbits/sec    0    144 KBytes
5003:  [  4]   5.00-6.00   sec  1.57 MBytes  13.1 Mbits/sec    0   37.1 KBytes
5001:  [  4]   5.00-6.00   sec  2.33 MBytes  19.5 Mbits/sec    0   57.0 KBytes
5002:  [  4]   5.00-6.00   sec  1.71 MBytes  14.3 Mbits/sec    0   58.5 KBytes
5000:  [  4]   5.00-6.00   sec  5.88 MBytes  49.3 Mbits/sec    0    144 KBytes
5003:  [  4]   6.00-7.00   sec  1.27 MBytes  10.6 Mbits/sec    0   37.1 KBytes
5001:  [  4]   6.00-7.00   sec  2.21 MBytes  18.5 Mbits/sec    0   57.0 KBytes
5002:  [  4]   6.00-7.00   sec  2.21 MBytes  18.5 Mbits/sec    0   58.5 KBytes
5000:  [  4]   6.00-7.00   sec  5.51 MBytes  46.2 Mbits/sec    0    144 KBytes
5003:  [  4]   7.00-8.00   sec  1.48 MBytes  12.4 Mbits/sec    0   37.1 KBytes
5001:  [  4]   7.00-8.00   sec  2.14 MBytes  18.0 Mbits/sec    0   57.0 KBytes
5002:  [  4]   7.00-8.00   sec  2.39 MBytes  20.0 Mbits/sec    0   58.5 KBytes
5000:  [  4]   7.00-8.00   sec  5.33 MBytes  44.7 Mbits/sec    0    144 KBytes
5003:  [  4]   8.00-9.00   sec  1.34 MBytes  11.2 Mbits/sec    0   37.1 KBytes
5001:  [  4]   8.00-9.00   sec  2.21 MBytes  18.5 Mbits/sec    0   57.0 KBytes
5002:  [  4]   8.00-9.00   sec  2.39 MBytes  20.0 Mbits/sec    0   58.5 KBytes
5000:  [  4]   8.00-9.00   sec  5.33 MBytes  44.7 Mbits/sec    0    144 KBytes
5001:  [  4]   9.00-10.00  sec  2.45 MBytes  20.6 Mbits/sec    0   57.0 KBytes
5001:  - - - - - - - - - - - - - - - - - - - - - - - - -
5001:  [ ID] Interval           Transfer     Bandwidth       Retr
5001:  [  4]   0.00-10.00  sec  19.8 MBytes  16.6 Mbits/sec    0             sender
5001:  [  4]   0.00-10.00  sec  19.6 MBytes  16.4 Mbits/sec                  receiver
5001:
5001:  iperf Done.
5003:  [  4]   9.00-10.00  sec  1.41 MBytes  11.9 Mbits/sec    0   37.1 KBytes
5003:  - - - - - - - - - - - - - - - - - - - - - - - - -
5003:  [ ID] Interval           Transfer     Bandwidth       Retr
5003:  [  4]   0.00-10.00  sec  15.2 MBytes  12.7 Mbits/sec    0             sender
5003:  [  4]   0.00-10.00  sec  15.1 MBytes  12.7 Mbits/sec                  receiver
5003:
5003:  iperf Done.
5002:  [  4]   9.00-10.00  sec  2.33 MBytes  19.5 Mbits/sec    0   58.5 KBytes
5002:  - - - - - - - - - - - - - - - - - - - - - - - - -
5002:  [ ID] Interval           Transfer     Bandwidth       Retr
5002:  [  4]   0.00-10.00  sec  19.0 MBytes  15.9 Mbits/sec    0             sender
5002:  [  4]   0.00-10.00  sec  18.8 MBytes  15.8 Mbits/sec                  receiver
5002:
5002:  iperf Done.
5000:  [  4]   9.00-10.00  sec  5.33 MBytes  44.7 Mbits/sec    0    144 KBytes
5000:  - - - - - - - - - - - - - - - - - - - - - - - - -
5000:  [ ID] Interval           Transfer     Bandwidth       Retr
5000:  [  4]   0.00-10.00  sec  60.3 MBytes  50.6 Mbits/sec    0             sender
5000:  [  4]   0.00-10.00  sec  59.9 MBytes  50.2 Mbits/sec                  receiver
5000:
5000:  iperf Done.

从上面我们可以清晰的看到,每一行的最开始,都标注了本行数据是那个端口的,这样是不是很清楚了~~~。

就写到这里吧,等发现其他的问题后,在整理补充。

后记:由于iperf3存在瞬间的不正常,然后又不能自动恢复,那么能不能实现监视server端,当server端异常的时候,重新启动server端呢,(现在想到的办法是,定时杀死,然后在启动,但是这样的情况下,杀死的时候,client端可能也在连接,这个时候也会报错误,不能完美的实现),如果有牛人可以解决这个问题,欢迎留言或者讨论,如果有和这个iperf3使用相关的问题和技巧也可以留言,欢迎!!!

嵌入式学习笔记--网络打流补充笔记(iperf3应用)相关推荐

  1. 嵌入式学习之TCP和UDP基础理解

    鸡汤:若有一个柠檬,那就做成柠檬水. 学习梳理目录: 1. 传输层的作用2. 端口的理解3. UDP学习4. TCP学习5. UDP首部学习6. TCP首部学习 传输层的作用 首先应说明的是TCP/I ...

  2. python网络编程需要学什么,python网络编程学习笔记(五):socket的一些补充 Python 网络编程需要学习哪些网络相关的知识...

    python的socket编程问题hdr = recvall(s, 5) if hdr is None: print 'Unexpected EOF receivingstruct在unpack的时候 ...

  3. 强化学习 补充笔记(TD算法、Q学习算法、SARSA算法、多步TD目标、经验回放、高估问题、对决网络、噪声网络)

    学习目标: 深入了解马尔科夫决策过程(MDP),包含TD算法.Q学习算法.SARSA算法.多步TD目标.经验回放.高估问题.对决网络.噪声网络.基础部分见:强化学习 马尔科夫决策过程(价值迭代.策略迭 ...

  4. 嵌入式学习笔记——STM32的USART通信概述

    文章目录 前言 常用通信协议分类及其特征介绍 通信协议 通信协议分类 1.同步异步通信 2.全双工/半双工/单工 3.现场总线/板级总线 4. 串行/并行通信 5. 有线通信.无线通信 STM32通信 ...

  5. 基于STM32G431嵌入式学习笔记——七、定时器定时

    一.题目引入 上述为第13届蓝桥杯省赛节选内容,为了研究定时器的机理并独立书写计时函数,上述内容简化为以下要求: ①按下B4按键,LD1点亮5s后熄灭 ②按下B3按键,LD2以0.1秒为间隔切换亮灭状 ...

  6. 嵌入式学习笔记——基于Cortex-M的单片机介绍

    基于Cortex-M的单片机介绍 前言 1生产厂商及其产品线 1.1ARM单片机的产品线 1.2命名规则 作业1 2习单片机的资料准备 2.1STM32开发所需手册 2.1.1芯片的数据手册 芯片基本 ...

  7. HALCON 21.11:深度学习笔记---网络和训练过程(4)

    HALCON 21.11:深度学习笔记---网络和训练过程(4) HALCON 21.11.0.0中,实现了深度学习方法.关于网络和训练过程如下: 在深度学习中,任务是通过网络发送输入图像来执行的.整 ...

  8. 嵌入式学习笔记——ADC模数转换器

    ADC模数转换器 前言 ADC介绍 ADC概述 ADC的数量 ADC的特性 ADC框图 芯片外部框图 芯片内部框图 转换部分框图 状态输出部分 条件触发框图 寄存器介绍 编程思路 模式选择 规则通道的 ...

  9. cortex_m3_stm32嵌入式学习笔记(十五):待机唤醒实验(WK_UP外部中断)

    cortex_m3_stm32嵌入式学习笔记(十五):待机唤醒实验(WK_UP外部中断) https://blog.csdn.net/qq_16255321/article/details/43086 ...

最新文章

  1. Spring @Autowired和@Resource
  2. 文件特殊权限suid、sgid、stick_bit、硬链接、软链接
  3. http://blog.csdn.net/luoshengyang/article/details/6651971
  4. Webix 1.5发布:一个强大的JavaScript UI组件库
  5. CTF---Web入门第十二题 程序逻辑问题
  6. 七天学会ASP.NET MVC(七)——创建单页应用
  7. 运维笔记--postgresql占用CPU问题定位
  8. 成功解决_catboost.CatBoostError: Bad value for num_feature[non_default_doc_idx=0,feature_idx=0]=“FDO09“:
  9. Spring静态资源访问配置
  10. checkbox控件的checked属性作用是_VB6基本控件的使用,制作一个数据输入窗口
  11. 可重入锁和不可重入锁
  12. (计算机组成原理)第三章存储系统-第七节1:页式存储器、页表及快表
  13. 桌面虚拟化之用户评估指南 (翻译)
  14. 【奇技淫巧】Android真机调试看不到应用logcat或者应用logcat信息太少的解决方法
  15. mysql学生管理系统背景_学生基本系统管理
  16. 计算机鼠标没有安装驱动,鼠标动不了怎么安装驱动_电脑鼠标不能动怎么安装驱动...
  17. 如何做蛋白质互作网络图
  18. 将hustoj 数据从Ubuntu 14.04 成功迁移到 ubuntu 16.04
  19. 安卓实现图片缩放平移的基本步骤
  20. c语言 code table,单片机C语言unsigned char code table是什么意思?

热门文章

  1. 中英文 php cms,phpcms v9英语语言包应用详解
  2. mysql找安装路经,更改密码
  3. RabbitMQ 3.6.x 安装和配置--Linux篇
  4. 比较Spring AOP与AspectJ
  5. jsp实现简单的分页
  6. LibreOJ β Round #2
  7. day1-字符串拼接、表达式、break和continue
  8. 单卡手机怎么变双卡双待全过程
  9. jstl标签: c:Foreach详解
  10. ios中tableview网封装(viewcontroller封装)常用的