事前説明
iperfとは、serverとclientでトラフィックを受け渡し、どれだけのトラフィックが流れたかを確認するツール。
iperf用のserverとclientを立てて、その間をプロトコルを指定して通信させながらスループットを測定する。
異なるOS間での測定も可能(これが便利)。
環境
今回は二つのPCの間にswiching hubを置き、その間のスループットを測定した。
iperf version: 3.1.3
iperf server: Ubuntu server 18.04 LTS
iperf client: Windows10
switching hub: netgear GS105E
目的
switching hubを挟んだ際の、2つのPC間のスループットを測る。
準備
下記のようなネットワークを作る。
実際の写真は以下のよう。

まだ、iperfにはバージョンがあり、バージョンが違うとスループットを測ることができない。
apt install iperf # version 2系
apt install iperf3 # version 3系
実測
$ iperf3 -s
$ iperf3 -c 192.168.0.2
server側、client側両方に詳細情報が出てくる。
例えば、client側のログはこんな感じ。
Connecting to host 192.168.0.2, port 5201
[ 5] local 192.168.0.10 port 54178 connected to 192.168.0.2 port 5201
iperf3: getsockopt - Protocol not available
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 5] 0.00-1.00 sec 108 MBytes 901 Mbits/sec 1296506930 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 1.00-2.00 sec 107 MBytes 898 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 2.00-3.00 sec 107 MBytes 899 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 3.00-4.00 sec 106 MBytes 893 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 4.00-5.00 sec 108 MBytes 911 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 5.00-6.00 sec 107 MBytes 898 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 6.00-7.00 sec 107 MBytes 896 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 7.00-8.00 sec 108 MBytes 902 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 8.00-9.00 sec 107 MBytes 895 Mbits/sec 0 0.00 Bytes
iperf3: getsockopt - Protocol not available
[ 5] 9.00-10.00 sec 108 MBytes 902 Mbits/sec 2998460366 0.00 Bytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 5] 0.00-10.00 sec 1.05 GBytes 900 Mbits/sec 0 sender
[ 5] 0.00-10.00 sec 1.05 GBytes 900 Mbits/sec receiver
iperf Done.
(補足) 今回、本当に知りたかったこと
目的として、netgear のスイッチでローカルポートミラーリングの際にスループットが低下しないかを実際に測定して確認したかった。
調べたら分かることなんだけど、運用していく上で本当にそこがボトルネックにならないか気になって仕方が無くなり、どうしても実地実験の結果が気になった。
今回、switchにローカルポートミラーリングの設定をして、その先に実際にパケットを送ってもスループットが低下しなかった!
良かった。