EdgerouterのUIからBandwitdhテストができるのだが、iperfが起動しない。
何回かRun Testをクリックすると使えるようになることもあるが。。。コンソールから起動したほうが確実。
調べてみるとなぜか2種類入っている。
/usr/bin/iperf -v
iperf version 2.0.9 (1 June 2016) pthreads
/usr/bin/iperf3 -v
iperf 3.6 (cJSON 1.5.2)
Linux gwubnt 4.9.79-UBNT #1 SMP Thu Mar 5 16:49:39 UTC 2020 mips64
Optional features available: CPU affinity setting, IPv6 flow label, SCTP, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing, authentication
うまく動いた時にpsコマンドでしらべてみたら、以下のコマンドが動いていた。
/usr/bin/iperf3 -s -i 1 -f k
クライアントからiperf -c IP_Addressとすると以下のようなログが表示される。
———————————————————–
Server listening on 5201
———————————————————–
Accepted connection from 192.168.19.73, port 54066
[ 5] local 192.168.19.1 port 5201 connected to 192.168.19.73 port 54068
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 105 MBytes 877939 Kbits/sec
[ 5] 1.00-2.00 sec 111 MBytes 931982 Kbits/sec
[ 5] 2.00-3.00 sec 111 MBytes 927690 Kbits/sec
[ 5] 3.00-4.00 sec 111 MBytes 931926 Kbits/sec
[ 5] 4.00-5.00 sec 111 MBytes 931210 Kbits/sec
[ 5] 5.00-6.00 sec 110 MBytes 922336 Kbits/sec
[ 5] 6.00-7.00 sec 111 MBytes 932005 Kbits/sec
[ 5] 7.00-8.00 sec 78.4 MBytes 657462 Kbits/sec
[ 5] 8.00-9.00 sec 73.6 MBytes 617558 Kbits/sec
[ 5] 9.00-10.00 sec 73.6 MBytes 616418 Kbits/sec
[ 5] 10.00-10.04 sec 2.88 MBytes 604763 Kbits/sec
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.04 sec 998 MBytes 833684 Kbits/sec receiver
帯域計測の準備ができたところで、狭帯域の環境をデモしたいのだが、VMware Workstationのように帯域を絞ったりできないものかと。。。そのためにWorkstationとかFusionを使いたくない。
VLANのリンクスピードを変えられないのか。。。。物理層は1GbEなので無理。
というわけでトラフィックシェーピングを使ってみる。
Linuxのインタフェースでやってもいいのだが、サブネット単にやりたいので、EdgeRouterで設定
まずはインタフェースの現環境から
Eth2 VLAN 136だけを10MbEにしたい。
configure
set traffic-policy shaper DOWNLOAD description “Download traffic shaper”
set traffic-policy shaper DOWNLOAD bandwidth 1000mbit
set traffic-policy shaper DOWNLOAD class 20 description “Download speed limit for VLAN”
set traffic-policy shaper DOWNLOAD class 20 bandwidth 10mbit
set traffic-policy shaper DOWNLOAD class 20 match VLAN20 vif 136
set traffic-policy shaper DOWNLOAD class 20 queue-type fair-queue
set traffic-policy shaper DOWNLOAD default bandwidth 100%
set traffic-policy shaper DOWNLOAD default queue-type fair-queue
set traffic-policy shaper UPLOAD description “Upload traffic shaper”
set traffic-policy shaper UPLOAD bandwidth 1000mbit
set traffic-policy shaper UPLOAD class 20 description “Upload speed limit for VLAN”
set traffic-policy shaper UPLOAD class 20 bandwidth 10mbit
set traffic-policy shaper UPLOAD class 20 match VLAN20 vif 136
set traffic-policy shaper UPLOAD class 20 queue-type fair-queue
set traffic-policy shaper UPLOAD default bandwidth 100%
set traffic-policy shaper UPLOAD default queue-type fair-queue
set interfaces ethernet eth2 redirect ifb1
set interfaces ethernet eth2 traffic-policy out DOWNLOAD
set interfaces input ifb1 traffic-policy out UPLOAD
commit
ちなみに解除する場合は、再起動はいらない。
configure
load
commit
exit
VLAN 135–> Routerのテスト
[root@BandTestT1 ~]# iperf3 -c 192.168.18.1
Connecting to host 192.168.18.1, port 5201
[ 5] local 192.168.18.82 port 44684 connected to 192.168.18.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 66.0 MBytes 553 Mbits/sec 450 195 KBytes
[ 5] 1.00-2.00 sec 71.2 MBytes 597 Mbits/sec 85 195 KBytes
[ 5] 2.00-3.00 sec 72.7 MBytes 610 Mbits/sec 0 195 KBytes
[ 5] 3.00-4.00 sec 71.1 MBytes 596 Mbits/sec 0 195 KBytes
[ 5] 4.00-5.00 sec 72.7 MBytes 610 Mbits/sec 0 195 KBytes
[ 5] 5.00-6.00 sec 69.6 MBytes 584 Mbits/sec 277 195 KBytes
[ 5] 6.00-7.00 sec 59.2 MBytes 497 Mbits/sec 295 195 KBytes
[ 5] 7.00-8.00 sec 75.1 MBytes 630 Mbits/sec 0 195 KBytes
[ 5] 8.00-9.00 sec 70.3 MBytes 590 Mbits/sec 105 187 KBytes
[ 5] 9.00-10.00 sec 47.3 MBytes 397 Mbits/sec 230 127 KBytes
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 675 MBytes 566 Mbits/sec 1442 sender
[ 5] 0.00-10.04 sec 671 MBytes 561 Mbits/sec receiver
VLAN 136–> Routerのテスト
[root@BandTest2 ~]# iperf3 -c 192.168.19.1
Connecting to host 192.168.19.1, port 5201
[ 5] local 192.168.19.73 port 54076 connected to 192.168.19.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 2.54 MBytes 21.3 Mbits/sec 14 14.1 KBytes
[ 5] 1.00-2.00 sec 1018 KBytes 8.34 Mbits/sec 0 14.1 KBytes
[ 5] 2.00-3.00 sec 1018 KBytes 8.34 Mbits/sec 0 14.1 KBytes
[ 5] 3.00-4.00 sec 1018 KBytes 8.34 Mbits/sec 0 14.1 KBytes
[ 5] 4.00-5.00 sec 1.49 MBytes 12.5 Mbits/sec 0 14.1 KBytes
[ 5] 5.00-6.00 sec 1018 KBytes 8.34 Mbits/sec 0 14.1 KBytes
[ 5] 6.00-7.00 sec 1018 KBytes 8.34 Mbits/sec 0 14.1 KBytes
[ 5] 7.00-8.00 sec 1.49 MBytes 12.5 Mbits/sec 0 14.1 KBytes
[ 5] 8.00-9.00 sec 1018 KBytes 8.34 Mbits/sec 0 14.1 KBytes
[ 5] 9.00-10.00 sec 1018 KBytes 8.34 Mbits/sec 0 5.66 KBytes
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 12.5 MBytes 10.5 Mbits/sec 14 sender
[ 5] 0.00-10.04 sec 11.3 MBytes 9.48 Mbits/sec receiver
同一サブネットでは影響受けない。どうやら実現できた様子。ただ、制限かけていないほうのトラフィックのスピードが若干下がってしまうようだ。