iperfとWireshark

# iperfの結果をWiresharkで確認
iperfで表示される帯域値が、Wiresharkでどのように確認できるかを検証。

## 環境
2台の端末を用意し、ClientとServerとをiperf3で通信させる。Server側コマンドは、TCPおよびUDPで共通で、下記となる。
```
$ iperf3 -s
```
## 検証
### TCP
#### iperfコマンドによる実行結果
```
C:\iperf-3.1.3-win64>iperf3 -c 192.168.10.201 --get-server-output
Connecting to host 192.168.10.201, port 5201
[  4] local 192.168.10.104 port 4071 connected to 192.168.10.201 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  9.12 MBytes  76.2 Mbits/sec
[  4]   1.00-2.00   sec  8.50 MBytes  71.4 Mbits/sec
[  4]   2.00-3.00   sec  8.75 MBytes  73.5 Mbits/sec
[  4]   3.00-4.00   sec  8.62 MBytes  72.3 Mbits/sec
[  4]   4.00-5.00   sec  8.25 MBytes  69.3 Mbits/sec
[  4]   5.00-6.01   sec  8.88 MBytes  74.2 Mbits/sec
[  4]   6.01-7.00   sec  8.12 MBytes  68.3 Mbits/sec
[  4]   7.00-8.00   sec  9.25 MBytes  77.6 Mbits/sec
[  4]   8.00-9.00   sec  9.50 MBytes  80.0 Mbits/sec
[  4]   9.00-10.00  sec  9.00 MBytes  75.2 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec  88.0 MBytes  73.8 Mbits/sec                  sender
[  4]   0.00-10.00  sec  88.0 MBytes  73.8 Mbits/sec                  receiver

Server output:
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.10.104, port 4070
[  5] local 192.168.10.201 port 5201 connected to 192.168.10.104 port 4071
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec  8.46 MBytes  70.9 Mbits/sec
[  5]   1.00-2.00   sec  8.85 MBytes  74.3 Mbits/sec
[  5]   2.00-3.00   sec  8.53 MBytes  71.6 Mbits/sec
[  5]   3.00-4.00   sec  8.75 MBytes  73.4 Mbits/sec
[  5]   4.00-5.00   sec  8.12 MBytes  68.1 Mbits/sec
[  5]   5.00-6.00   sec  8.79 MBytes  73.7 Mbits/sec
[  5]   6.00-7.00   sec  8.24 MBytes  69.2 Mbits/sec
[  5]   7.00-8.00   sec  9.22 MBytes  77.4 Mbits/sec
[  5]   8.00-9.00   sec  9.55 MBytes  80.1 Mbits/sec
[  5]   9.00-10.00  sec  8.97 MBytes  75.3 Mbits/sec
[  5]  10.00-10.05  sec   512 KBytes  79.9 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.05  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.05  sec  88.0 MBytes  73.4 Mbits/sec                  receiver


iperf Done.
```
73MB/s程度の結果となっている。

#### Wiresharkの結果
メニュー「統計」→「対話」の結果は下記となる。
![TCPのコピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/634816/288e7fd4-a173-fafa-5449-9bbded21ca30.png)
メニュー「統計」→「入出力グラフ」の結果は下記となる。
![TCPグラフ.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/634816/f73d6cef-e753-1955-1054-3ebadb0a9b5f.png)

およそ76MB/sとなっており、コマンド実行結果とほぼ同じである。

### UDP
#### 帯域50MB/s指定
##### iperfコマンドによる実行結果
```
C:\iperf-3.1.3-win64>iperf3 -c 192.168.10.201 -u -b 50M -l 1K --get-server-output
Connecting to host 192.168.10.201, port 5201
[  4] local 192.168.10.104 port 52922 connected to 192.168.10.201 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  5.67 MBytes  47.6 Mbits/sec  5810
[  4]   1.00-2.01   sec  6.12 MBytes  50.9 Mbits/sec  6270
[  4]   2.01-3.00   sec  6.06 MBytes  51.2 Mbits/sec  6203
[  4]   3.00-4.01   sec  5.80 MBytes  48.2 Mbits/sec  5936
[  4]   4.01-5.01   sec  5.92 MBytes  49.7 Mbits/sec  6066
[  4]   5.01-6.00   sec  6.09 MBytes  51.4 Mbits/sec  6235
[  4]   6.00-7.00   sec  5.58 MBytes  47.0 Mbits/sec  5717
[  4]   7.00-8.01   sec  6.36 MBytes  52.9 Mbits/sec  6510
[  4]   8.01-9.00   sec  5.60 MBytes  47.3 Mbits/sec  5737
[  4]   9.00-10.00  sec  5.91 MBytes  49.6 Mbits/sec  6051
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec  59.1 MBytes  49.6 Mbits/sec  0.143 ms  1/60533 (0.0017%)
[  4] Sent 60533 datagrams

Server output:
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.10.104, port 4432
[  5] local 192.168.10.201 port 5201 connected to 192.168.10.104 port 52922
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  5]   0.00-1.00   sec  5.11 MBytes  42.8 Mbits/sec  0.335 ms  0/5229 (0%)
[  5]   1.00-2.00   sec  6.23 MBytes  52.2 Mbits/sec  0.144 ms  0/6379 (0%)
[  5]   2.00-3.00   sec  5.95 MBytes  49.9 Mbits/sec  0.090 ms  0/6090 (0%)
[  5]   3.00-4.00   sec  6.01 MBytes  50.4 Mbits/sec  0.114 ms  0/6152 (0%)
[  5]   4.00-5.00   sec  6.03 MBytes  50.6 Mbits/sec  0.076 ms  0/6175 (0%)
[  5]   5.00-6.00   sec  5.87 MBytes  49.3 Mbits/sec  0.089 ms  0/6010 (0%)
[  5]   6.00-7.00   sec  5.44 MBytes  45.6 Mbits/sec  0.202 ms  1/5574 (0.018%)
[  5]   7.00-8.00   sec  6.38 MBytes  53.6 Mbits/sec  0.210 ms  0/6534 (0%)
[  5]   8.00-9.00   sec  5.69 MBytes  47.8 Mbits/sec  0.092 ms  0/5831 (0%)
[  5]   9.00-10.00  sec  5.88 MBytes  49.3 Mbits/sec  0.355 ms  0/6025 (0%)
[  5]  10.00-10.07  sec   534 KBytes  61.0 Mbits/sec  0.143 ms  0/534 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  5]   0.00-10.07  sec  0.00 Bytes  0.00 bits/sec  0.143 ms  1/60533 (0.0017%)
[SUM]  0.0-10.1 sec  1 datagrams received out-of-order


iperf Done.
```
およそ指定どおりの値（50MB/s）となっている。

#### Wiresharkの結果
メニュー「統計」→「対話」の結果は下記となる。
![UDP50Mのコピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/634816/efd2ce23-2773-cb68-a361-59d0e6370979.png)
メニュー「統計」→「入出力グラフ」の結果は下記となる。
![UDP50Mグラフ.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/634816/0217a499-0d68-e61a-6298-a630a7d934dc.png)

およそ51MB/sとなっており、コマンド実行（指定）結果とほぼ同じである。

#### 帯域100MB/s指定
##### iperfコマンドによる実行結果
```
C:\iperf-3.1.3-win64>iperf3 -c 192.168.10.201 -u -b 100M -l 1K --get-server-output
Connecting to host 192.168.10.201, port 5201
[  4] local 192.168.10.104 port 59237 connected to 192.168.10.201 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  2.16 MBytes  18.1 Mbits/sec  2210
[  4]   1.00-2.00   sec  10.1 MBytes  85.0 Mbits/sec  10380
[  4]   2.00-3.00   sec  10.4 MBytes  87.6 Mbits/sec  10695
[  4]   3.00-4.00   sec  11.6 MBytes  97.0 Mbits/sec  11844
[  4]   4.00-5.00   sec  12.6 MBytes   105 Mbits/sec  12861
[  4]   5.00-6.00   sec  12.1 MBytes   101 Mbits/sec  12355
[  4]   6.00-7.00   sec  12.5 MBytes   104 Mbits/sec  12751
[  4]   7.00-8.00   sec  11.3 MBytes  95.0 Mbits/sec  11602
[  4]   8.00-9.00   sec  12.0 MBytes   100 Mbits/sec  12246
[  4]   9.00-10.00  sec  12.2 MBytes   103 Mbits/sec  12540
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec   107 MBytes  89.7 Mbits/sec  0.092 ms  445/109482 (0.41%)
[  4] Sent 109482 datagrams

Server output:
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.10.104, port 1025
[  5] local 192.168.10.201 port 5201 connected to 192.168.10.104 port 59237
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  5]   0.00-1.00   sec  2.04 MBytes  17.1 Mbits/sec  0.506 ms  1/2091 (0.048%)
[  5]   1.00-2.00   sec  9.22 MBytes  77.3 Mbits/sec  0.129 ms  444/9885 (4.5%)
[  5]   2.00-3.00   sec  10.3 MBytes  86.7 Mbits/sec  0.072 ms  0/10579 (0%)
[  5]   3.00-4.00   sec  11.7 MBytes  98.0 Mbits/sec  0.103 ms  0/11959 (0%)
[  5]   4.00-5.00   sec  12.6 MBytes   105 Mbits/sec  0.152 ms  0/12868 (0%)
[  5]   5.00-6.00   sec  12.0 MBytes   100 Mbits/sec  0.061 ms  0/12264 (0%)
[  5]   6.00-7.00   sec  12.4 MBytes   104 Mbits/sec  0.127 ms  0/12741 (0%)
[  5]   7.00-8.00   sec  11.4 MBytes  95.7 Mbits/sec  0.115 ms  0/11683 (0%)
[  5]   8.00-9.00   sec  11.9 MBytes  99.5 Mbits/sec  0.082 ms  0/12159 (0%)
[  5]   9.00-10.00  sec  12.3 MBytes   103 Mbits/sec  0.091 ms  0/12581 (0%)
[  5]  10.00-10.06  sec   672 KBytes  94.2 Mbits/sec  0.092 ms  0/672 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  5]   0.00-10.06  sec  0.00 Bytes  0.00 bits/sec  0.092 ms  445/109482 (0.41%)
[SUM]  0.0-10.1 sec  1 datagrams received out-of-order


iperf Done.
```
およそ指定どおりの値（100MB/s）となっている。

#### Wiresharkの結果
メニュー「統計」→「対話」の結果は下記となる。
![UDP100Mのコピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/634816/68fdebef-8386-caa4-70c1-0f403ebbfb25.png)
メニュー「統計」→「入出力グラフ」の結果は下記となる。
![UDP100Mグラフ.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/634816/5e9c6c44-333a-9ca0-5fdd-e9a88f896e6c.png)

およそ92MB/sとなっており、コマンド実行（指定）結果とほぼ同じである。

## 終わりに
条件によるかもしれないが、iperfの結果とWiresharkとの照合ができたと考えたい。