Windows10,Server 2019でiPerf3の使い方!通信帯域、スループット測定に便利

f:id:merrywhite:20200405094722j:plain

世の中にはたくさんのフリーツールがありますが、知っておくと便利なソフトはたくさんあります。


そして、これまでネットワークエンジニアとして、帯域の調査をすることがよくありましたが、最近はサーバー基盤が10GBの太い帯域で構成されることが多いので、ネットワークのスループットが問題になることが少なくなってきました。

 

最近は帯域が足りないってあんまり聞かなくなりました。インターネットに接続する場合は別ですが、社内LANでは速度が出るので社内間通信では遅いとか少ないのではないでしょうか。※サーバのサイジング失敗、チューニング不足などは別です。


以前は、100Mの細い帯域を奪い合いみたいにパケットが飛び交う時代がありましたらからね。正しく構成していれば、利用用途毎に帯域やネットワークを分けることで、効率よく通信を行うこともできますし、お互いに影響を与えないようにすることもできます。


さて、以前もサーバー仮想化基盤で10GBのネットワークを準備したこともあり、帯域測定で使用したのがiperfです。実際に、10GBの帯域調査ってどのツールを使えばいいかわからないと思います。このツールは、ソフトウェアストレージを導入してくれたメーカーさんが教えてくれました。


普段、ストレージとサーバー間の帯域調査でも使うツールとのことです。昔使った記憶がありましたが、久しぶりに使うとかなり便利で使いやすいと感じましたので、改めて紹介します。


ちょうど自宅の無線LANを入れ替えたこともあり、旧無線APと新無線AP間でどれくらい速度の差ができるか調査してみたくなったので、iperfを使う事にしました。


自宅のパソコンがWindows10とWindows7なので、それぞれに対応したiperfのダウンロードを行います。

 


ダウンロード先はこちら。

★iPerf - The ultimate speed test tool for TCP, UDP and SCTP
Test the limits of your network + Internet neutrality test

https://iperf.fr/iperf-download.php

 


これだけ種類があります。Windows版は「Download iPerf for Windows」を選択します。

Download iPerf for Windows
Download iPerf3 for Android
Download iPerf3 for iPhone / iPad
Download iPerf3 for Apple macOS
Download iPerf for Ubuntu / Debian / Mint
Download iPerf for Fedora / Red Hat / CentOS
Download iPerf for openSUSE
Download iPerf for Arch Linux
Download iPerf for FreeBSD


今回、チェックしたタイミングでは、最新バージョンは「iPerf 3.1.3」です。

Windows 64 bits compiled by Vivien Guéant. (sha256)
iPerf 3.1.3 (8 jun 2016 - 1.3 MiB for Windows Vista 64bits to Windows 10 64bits)
iPerf 3.1.2 (1 fev 2016 - 1.3 MiB for Windows Vista 64bits to Windows 10 64bits)
iPerf 3.0.12 (8 jun 2016 - 1.3 MiB for Windows Vista 64bits to Windows 10 64bits)
iPerf 3.0.11 (9 jan 2015 - 1.3 MiB for Windows Vista 64bits to Windows 10 64bits)
iPerf 2.0.9 (6 jun 2016 - 1.7 MiB for Windows Vista 64bits to Windows 10 64bits)
iPerf 2.0.8b (17 sep 2015 - 1.6 MiB for Windows Vista 64bits to Windows 10 64bits)


我が家は10も7もどちらも64bitなので、同じものを使いました。今の時代、32bit版を探す方が難しいと思います。


続いて、圧縮されているので、解凍して使用します。フォルダーの中身はこんな感じです。

C:\iperf-3.1.3-win64ディレクト
2016/04/21 22:14 3,539,372 cygwin1.dll
2016/06/09 10:30 468,748 iperf3.exe

コマンドプロンプトを起動して、「cd」コマンドでカレントディレクトリを「iperf3.exe」が配置されたディレクトリに移動して実行すると簡単に使用できます。※Windowsはフォルダのほうが分かりやすいですね。


下準備として、同じものをWindows10とwindows7の任意の場所に配置しておきます。


【iperfの使い方】

①解凍済みのiperfを調査を行う端末それぞれの任意の場所に配置

コマンドプロンプトを起動し、iperfを格納したフォルダへカレントディレクトリを移動

# cd <iperf.exeのあるフォルダ>

③サーバとクライアントの役割を決めます。

サーバ側は以下のコマンドを実行します。「-s」がサーバーモードになります。

# iperf3.exe -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

続いて、クライアント側で以下のコマンド(iperf3.exe -c <serverのIPアドレス>)を実行します。※「-c」がクライアントモードを指定になります。


C:\iperf-3.1.3-win64>iperf3.exe -c 192.168.xx.x
Connecting to host 192.168.xx.xx, port 5201
[ 4] local 192.168.xx.xx port 53377 connected to 192.168.xx.xx port 5201
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 4.50 MBytes 37.7 Mbits/sec
[ 4] 1.00-2.00 sec 4.62 MBytes 38.8 Mbits/sec
[ 4] 2.00-3.00 sec 4.38 MBytes 36.7 Mbits/sec
[ 4] 3.00-4.00 sec 4.50 MBytes 37.8 Mbits/sec
[ 4] 4.00-5.00 sec 4.62 MBytes 38.8 Mbits/sec
[ 4] 5.00-6.00 sec 4.75 MBytes 39.9 Mbits/sec
[ 4] 6.00-7.00 sec 4.50 MBytes 37.8 Mbits/sec
[ 4] 7.00-8.00 sec 4.62 MBytes 38.8 Mbits/sec
[ 4] 8.00-9.00 sec 4.88 MBytes 40.9 Mbits/sec
[ 4] 9.00-10.00 sec 5.12 MBytes 43.0 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-10.00 sec 46.5 MBytes 39.0 Mbits/sec sender
[ 4] 0.00-10.00 sec 46.5 MBytes 39.0 Mbits/sec receiver


無線経由ですが、約40MBほど帯域があることがわかります。性能のいいもの(無線AP)を買ったんですが、意外と帯域がでないですね。ただ、5GHz帯で試したら200MB近く出たので、やっぱり5GHz帯のほうが圧倒的に速度がでますね。


また、意外と便利なのが、iperfって10GBの速度でも調査ができるので、きちんと帯域がでているかの確認でも使えて便利です。


ちなみに、オプションはこちらです。

------
iperf3: parameter error - must either be a client (-c) or server (-s)

Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-v|--version]

Server or Client:
-p, --port # server port to listen on/connect to
-f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes
-i, --interval # seconds between periodic bandwidth reports
-F, --file name xmit/recv the specified file
-B, --bind <host> bind to a specific interface
-V, --verbose more detailed output
-J, --json output in JSON format
--logfile f send output to a log file
-d, --debug emit debugging output
-v, --version show version information and quit
-h, --help show this message and quit
Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon
-I, --pidfile file write PID file
-1, --one-off handle one client connection then exit
Client specific:
-c, --client <host> run in client mode, connecting to <host>
-u, --udp use UDP rather than TCP
-b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
(default 1 Mbit/sec for UDP, unlimited for TCP)
(optional slash and packet count for burst mode)
-t, --time # time in seconds to transmit for (default 10 secs)
-n, --bytes #[KMG] number of bytes to transmit (instead of -t)
-k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n)
-l, --len #[KMG] length of buffer to read or write
(default 128 KB for TCP, 8 KB for UDP)
--cport <port> bind to a specific client port (TCP and UDP, default: ephemeral port)
-P, --parallel # number of parallel client streams to run
-R, --reverse run in reverse mode (server sends, client receives)
-w, --window #[KMG] set window size / socket buffer size
-M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes)
-N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm
-4, --version4 only use IPv4
-6, --version6 only use IPv6
-S, --tos N set the IP 'type of service'
-Z, --zerocopy use a 'zero copy' method of sending data
-O, --omit N omit the first n seconds
-T, --title str prefix every output line with this string
--get-server-output get results from server
--udp-counters-64bit use 64-bit counters in UDP test packets
------


帯域調査って最近は実施することが減っているかもしれませんが、ちょっとした調査で便利なので活用してみてください。


また、仮想化基盤の場合、OSの種別や仮想NICによっては速度がでないことがあるので、環境に注意してください。CentOS7で、VMXNET3にした場合は、10GBに近い帯域を出すこと確認できました。