【Linuxの勉強】Netperfで仮想マシン間のスループット計測

【Linuxの勉強】Netperfで仮想マシン間のスループット計測

>>この記事はこんな人におすすめ!

Netperfのダウンロード方法が分からない

サーバー間のスループットの計測方法を教えてほしい

仮想マシン間を使用してNetperfを使ってスループットを測定する勉強をしたい

>>記事の概要

今回はNetperfのダウンロード方法、使用方法を解説します。

Netperfは通信のスループットを確認することがツールです。

実際に仮想マシンを2つ使用して、それぞれのホスト間でNetperfを使用し、
スループットを計測します。

Netperfを使おうとしてもなかなかうまく使用できないことが多いです。
なぜなら、Netperfは同じバージョン出ないとうまく動作しないなどの不具合があるからです。

そのため、ちゃんとNetperfを使用できるように1からダウンロード方法、Netperfの使用方法を確認していきます。

>>今回の検証で行う内容

今回の検証で使用する環境

今回の検証では以下の環境を使用します。

・Centosバージョン7の仮想マシン2台
※使用する仮想マシンはデフォルトの状態で使用。
※WindowsのPC(メモリ8G)で上記の2種類の仮想マシンを動作させました。
 そのため、PCのメモリの使用率が高めです。


今回の検証で行うこと

検証でやること

1.Netperfのインストール(クライアント側・サーバ側両方)

2.サーバー側でファイアーウォールの穴あけ

3.サーバー側でサーバー機能(netserver)を実行

4.クライアント側でNetperfコマンドの実行

5.スループットの確認

 検証のイメージ

Netperfで仮想マシン間のスループット計測

>>Netperfのインストール手順

この章では、実際にNetperfコマンドのインストールから、スループット計測までの手順を説明します。

恐らく、このNetperfコマンドを実際に使用したことがある方は少ないと思うので、
貴重な体験になるはずです。

このNetperfのインストールは、クライアント側とサーバー側の両方で行う必要があります。

Netperf(ソースコード)のダウンロード方法

Netperfコマンドは以下の方法でダウンロードします。

wget https://github.com/HewlettPackard/netperf/archive/refs/tags/netperf-2.7.0.tar.gz

wgetコマンドはLinuxで利用できる、ファイルを入手するためのコマンドです。
wget URL の形式で使用します。

上記ののコマンドは、URLにアクセスして、「netperf-2.7.0.tar.gz」ファイルをダウンロードしています。

ダウンロードした「netperf-2.7.0.tar.gz」ファイルは、複数のファイルをまとめて1つにした
アーカイブです


このアーカイブファイルの中には、ソースプログラムが含まれています。
このソースプログラムがNetperfコマンドの実態(プログラム)です。

ソースプログラムがまとめられたアーカイブファイルは、圧縮しているため展開する必要があります。
展開してソースプログラムをコンパイル(人間のプログラミング言語を機械が読み取れるように翻訳)し、
コンピュータが実行(読み取ることが出来る)バイナリファイルを作成します。
その後、バイナリファイルを適切なディレクトリにインストールすることで、
プログラム、今回でいうとNetperfが使用できるようになります。

実際にダウンロードしたときのログがこちらです。

[root@centosvm ]# 
[root@centosvm ]# wget https://github.com/HewlettPackard/netperf/archive/refs/tags/netperf-2.7.0.tar.gz
--2022-08-25 20:56:38--  https://github.com/HewlettPackard/netperf/archive/refs/tags/netperf-2.7.0.tar.gz
github.com (github.com) をDNSに問いあわせています... 20.27.177.113, 64:ff9b::141b:b171
github.com (github.com)|20.27.177.113|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: https://codeload.github.com/HewlettPackard/netperf/tar.gz/refs/tags/netperf-2.7.0 [続く]
--2022-08-25 20:56:39--  https://codeload.github.com/HewlettPackard/netperf/tar.gz/refs/tags/netperf-2.7.0
codeload.github.com (codeload.github.com) をDNSに問いあわせています... 20.27.177.114, 64:ff9b::141b:b172
codeload.github.com (codeload.github.com)|20.27.177.114|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 特定できません [application/x-gzip]
`netperf-2.7.0.tar.gz' に保存中

    [      <=>                                                      ] 1,993,943   1.68MB/s 時間 1.1s   

2022-08-25 20:56:41 (1.68 MB/s) - `netperf-2.7.0.tar.gz' へ保存終了 [1993943]

「netperf-2.7.0.tar.gz」ファイルを展開

先ほどダウンロードした「netperf-2.7.0.tar.gz」ファイルは、圧縮されているため、
回答する必要があります。

今回は展開のために、tarコマンドを使用します。

tar zxvf netperf-2.7.0.tar.gz

実際に上記のコマンドを使用して展開したログが↓です。

[root@centosvm]# tar zxvf netperf-2.7.0.tar.gz
netperf-netperf-2.7.0/
netperf-netperf-2.7.0/AUTHORS
netperf-netperf-2.7.0/COPYING
netperf-netperf-2.7.0/ChangeLog
netperf-netperf-2.7.0/INSTALL
netperf-netperf-2.7.0/Makefile.am
netperf-netperf-2.7.0/Makefile.in
netperf-netperf-2.7.0/NEWS
netperf-netperf-2.7.0/README
netperf-netperf-2.7.0/README.aix
netperf-netperf-2.7.0/README.hpux
netperf-netperf-2.7.0/README.osx
netperf-netperf-2.7.0/README.ovms
netperf-netperf-2.7.0/README.solaris
netperf-netperf-2.7.0/README.vmware
netperf-netperf-2.7.0/README.windows
netperf-netperf-2.7.0/Release_Notes
netperf-netperf-2.7.0/acinclude.m4
netperf-netperf-2.7.0/aclocal.m4
netperf-netperf-2.7.0/autogen.sh
netperf-netperf-2.7.0/config.guess
netperf-netperf-2.7.0/config.h.in
netperf-netperf-2.7.0/config.sub
netperf-netperf-2.7.0/configure
netperf-netperf-2.7.0/configure.ac
netperf-netperf-2.7.0/depcomp
netperf-netperf-2.7.0/doc/
netperf-netperf-2.7.0/doc/Makefile.am
netperf-netperf-2.7.0/doc/Makefile.in
netperf-netperf-2.7.0/doc/examples/
netperf-netperf-2.7.0/doc/examples/Makefile.am
netperf-netperf-2.7.0/doc/examples/Makefile.in
netperf-netperf-2.7.0/doc/examples/arr_script
netperf-netperf-2.7.0/doc/examples/bloat.py
netperf-netperf-2.7.0/doc/examples/bloat.sh
netperf-netperf-2.7.0/doc/examples/find_max_burst.sh
netperf-netperf-2.7.0/doc/examples/mins_maxes.awk
netperf-netperf-2.7.0/doc/examples/netperf_by_flavor.py
netperf-netperf-2.7.0/doc/examples/netperf_by_quantum.py
netperf-netperf-2.7.0/doc/examples/netperf_interim_to_rrd.sh
netperf-netperf-2.7.0/doc/examples/packet_byte_script
netperf-netperf-2.7.0/doc/examples/post_proc.py
netperf-netperf-2.7.0/doc/examples/post_proc.sh
netperf-netperf-2.7.0/doc/examples/remote_hosts
netperf-netperf-2.7.0/doc/examples/runemomni.sh
netperf-netperf-2.7.0/doc/examples/runemomniagg2.sh
netperf-netperf-2.7.0/doc/examples/runemomniaggdemo.sh
netperf-netperf-2.7.0/doc/examples/runremomniaggdemo.sh
netperf-netperf-2.7.0/doc/examples/runremrandomniaggdemo.sh
netperf-netperf-2.7.0/doc/examples/sctp_stream_script
netperf-netperf-2.7.0/doc/examples/set_affinity.sh
netperf-netperf-2.7.0/doc/examples/snapshot_script
netperf-netperf-2.7.0/doc/examples/tcp_range_script
netperf-netperf-2.7.0/doc/examples/tcp_rr_script
netperf-netperf-2.7.0/doc/examples/tcp_stream_script
netperf-netperf-2.7.0/doc/examples/udp_rr_script
netperf-netperf-2.7.0/doc/examples/udp_stream_script
netperf-netperf-2.7.0/doc/examples/vrules.awk
netperf-netperf-2.7.0/doc/netperf.html
netperf-netperf-2.7.0/doc/netperf.info
netperf-netperf-2.7.0/doc/netperf.man
netperf-netperf-2.7.0/doc/netperf.pdf
netperf-netperf-2.7.0/doc/netperf.ps
netperf-netperf-2.7.0/doc/netperf.texi
netperf-netperf-2.7.0/doc/netperf.txt
netperf-netperf-2.7.0/doc/netperf.xml
netperf-netperf-2.7.0/doc/netperf_old.ps
netperf-netperf-2.7.0/doc/netserver.man
netperf-netperf-2.7.0/doc/omni_output_list.txt
netperf-netperf-2.7.0/doc/texinfo.tex
netperf-netperf-2.7.0/inet_ntop.c
netperf-netperf-2.7.0/install-sh
netperf-netperf-2.7.0/m4/
netperf-netperf-2.7.0/m4/m4/
netperf-netperf-2.7.0/m4/m4/salen.m4
netperf-netperf-2.7.0/m4/m4/sockaddrin6.m4
netperf-netperf-2.7.0/m4/m4/sockinttypes.m4
netperf-netperf-2.7.0/missing
netperf-netperf-2.7.0/mkinstalldirs
netperf-netperf-2.7.0/netperf.spec.in
netperf-netperf-2.7.0/src/
netperf-netperf-2.7.0/src/Makefile.am
netperf-netperf-2.7.0/src/Makefile.in
netperf-netperf-2.7.0/src/Makefile.uw
netperf-netperf-2.7.0/src/NetPerfDir/
netperf-netperf-2.7.0/src/NetPerfDir/inet_ntop.c
netperf-netperf-2.7.0/src/NetPerfDir/makefile
netperf-netperf-2.7.0/src/NetPerfDir/sources
netperf-netperf-2.7.0/src/NetServerDir/
netperf-netperf-2.7.0/src/NetServerDir/inet_ntop.c
netperf-netperf-2.7.0/src/NetServerDir/makefile
netperf-netperf-2.7.0/src/NetServerDir/sources
netperf-netperf-2.7.0/src/dirs
netperf-netperf-2.7.0/src/dscp.c
netperf-netperf-2.7.0/src/hist.h
netperf-netperf-2.7.0/src/missing/
netperf-netperf-2.7.0/src/missing/Makefile.am
netperf-netperf-2.7.0/src/missing/Makefile.in
netperf-netperf-2.7.0/src/missing/getaddrinfo.c
netperf-netperf-2.7.0/src/missing/getaddrinfo.h
netperf-netperf-2.7.0/src/missing/inet_ntop.c
netperf-netperf-2.7.0/src/missing/inttypes.h
netperf-netperf-2.7.0/src/missing/m4/
netperf-netperf-2.7.0/src/missing/m4/Makefile.am
netperf-netperf-2.7.0/src/missing/m4/Makefile.in
netperf-netperf-2.7.0/src/missing/m4/herrno.m4
netperf-netperf-2.7.0/src/missing/m4/in6addr.m4
netperf-netperf-2.7.0/src/missing/m4/salen.m4
netperf-netperf-2.7.0/src/missing/m4/sockaddrin6.m4
netperf-netperf-2.7.0/src/missing/m4/sockinttypes.m4
netperf-netperf-2.7.0/src/missing/m4/socklent.m4
netperf-netperf-2.7.0/src/missing/m4/type_socklen_t.m4
netperf-netperf-2.7.0/src/missing/stdint.h
netperf-netperf-2.7.0/src/net_uuid.c
netperf-netperf-2.7.0/src/netcpu.h
netperf-netperf-2.7.0/src/netcpu_kstat.c
netperf-netperf-2.7.0/src/netcpu_kstat10.c
netperf-netperf-2.7.0/src/netcpu_looper.c
netperf-netperf-2.7.0/src/netcpu_none.c
netperf-netperf-2.7.0/src/netcpu_ntperf.c
netperf-netperf-2.7.0/src/netcpu_osx.c
netperf-netperf-2.7.0/src/netcpu_perfstat.c
netperf-netperf-2.7.0/src/netcpu_procstat.c
netperf-netperf-2.7.0/src/netcpu_pstat.c
netperf-netperf-2.7.0/src/netcpu_pstatnew.c
netperf-netperf-2.7.0/src/netcpu_sysctl.c
netperf-netperf-2.7.0/src/netdrv_ethtool.c
netperf-netperf-2.7.0/src/netdrv_none.c
netperf-netperf-2.7.0/src/netdrv_solaris.c
netperf-netperf-2.7.0/src/netfirewall_linux.c
netperf-netperf-2.7.0/src/netfirewall_none.c
netperf-netperf-2.7.0/src/netlib.c
netperf-netperf-2.7.0/src/netlib.h
netperf-netperf-2.7.0/src/netperf.c
netperf-netperf-2.7.0/src/netperf_version.h.in
netperf-netperf-2.7.0/src/netrt_none.c
netperf-netperf-2.7.0/src/netrt_rtmget.c
netperf-netperf-2.7.0/src/netrt_rtnetlink.c
netperf-netperf-2.7.0/src/netsec_linux.c
netperf-netperf-2.7.0/src/netsec_none.c
netperf-netperf-2.7.0/src/netsec_win.c
netperf-netperf-2.7.0/src/netserver.c
netperf-netperf-2.7.0/src/netsh.c
netperf-netperf-2.7.0/src/netsh.h
netperf-netperf-2.7.0/src/netslot_linux.c
netperf-netperf-2.7.0/src/netslot_none.c
netperf-netperf-2.7.0/src/netslot_solaris.c
netperf-netperf-2.7.0/src/netslot_ux1131.c
netperf-netperf-2.7.0/src/netsys_hpux11i.c
netperf-netperf-2.7.0/src/netsys_linux.c
netperf-netperf-2.7.0/src/netsys_none.c
netperf-netperf-2.7.0/src/netsys_solaris.c
netperf-netperf-2.7.0/src/nettest_bsd.c
netperf-netperf-2.7.0/src/nettest_bsd.h
netperf-netperf-2.7.0/src/nettest_dlpi.c
netperf-netperf-2.7.0/src/nettest_dlpi.h
netperf-netperf-2.7.0/src/nettest_omni.c
netperf-netperf-2.7.0/src/nettest_sctp.c
netperf-netperf-2.7.0/src/nettest_sctp.h
netperf-netperf-2.7.0/src/nettest_sdp.c
netperf-netperf-2.7.0/src/nettest_sdp.h
netperf-netperf-2.7.0/src/nettest_unix.c
netperf-netperf-2.7.0/src/nettest_unix.h
netperf-netperf-2.7.0/src/nettest_xti.c
netperf-netperf-2.7.0/src/nettest_xti.h
[root@centosvm]# 

netperf-netperf-2.7.0ディレクトリに移動

先ほどwgetコマンドを使用して、アーカイブファイル(netperf-2.7.0.tar.gz)を
wgetコマンドを実行したディレクトリにダウンロードしました。
そして、tarコマンドを使用し、アーカイブファイル(netperf-2.7.0.tar.gz)を展開しました。

アーカイブファイル(netperf-2.7.0.tar.gz)を展開すると、新たにnetperf-netperf-2.7.0ディレクトリが作成されます。
※netperf-netperf-2.7.0ディレクトリは、wgetコマンドを使用したディレクトリに作成されます。

この後の作業で、netperf-netperf-2.7.0ディレクトリ移り作業をする必要があるので、
一度netperf-netperf-2.7.0ディレクトリに㏅コマンドで移動します。

cd netperf-netperf-2.7.0

コマンドの実行結果は↓ようになります。

[root@centosvm ]# cd netperf-netperf-2.7.0
[root@centosvm netperf-netperf-2.7.0]# pwd
/home/username/netperf-netperf-2.7.0
[root@centosvm netperf-netperf-2.7.0]# 

configureスクリプトの実行

次にconfigureスクリプトを実行します。

configureスクリプトとは、プログラムをコンパイルする際に必要となる環境をチェックして、
環境に合わせたMakefileを作成します。
ちなみに、この時、configureスクリプトによってチェックされる環境は、具体的に言うと、コンパイラや
ライブラリ、ユーティリティーなどです。

今回はカレントディレクトリにあるconfigureスクリプトを事項するため、↓のコマンドを実行します。
※先ほどnetperf-netperf-2.7.0ディレクトリに移動したのは、カレントディレクトリにあるconfigureスクリプトを
実行するためです。

./configure
※「./」をつけることで、カレントディレクトリのconfigureスクリプトを実行します。

ちなみに、configureスクリプトが本当にあるかどうか念のため、確認しました。
↓の出力で、netperf-netperf-2.7.0ディレクトリに「configure」というファイルがあることが確認できます。
このファイルを使用して環境のチェックを行い、Makefileを作成します。


root@centosvm netperf-netperf-2.7.0]# pwd
/home/username/netperf-netperf-2.7.0
[root@centosvm netperf-netperf-2.7.0]# ls -l 
合計 780
-rw-rw-r--. 1 root root   8852  7月 21  2015 AUTHORS
-rw-rw-r--. 1 root root   2079  7月 21  2015 COPYING
-rw-rw-r--. 1 root root     27  7月 21  2015 ChangeLog
-rw-rw-r--. 1 root root   9240  7月 21  2015 INSTALL
-rw-rw-r--. 1 root root      0  7月 21  2015 NEWS
-rw-rw-r--. 1 root root   2104  7月 21  2015 README
-rw-rw-r--. 1 root root   1673  7月 21  2015 README.aix
-rw-rw-r--. 1 root root   1772  7月 21  2015 README.hpux
-rw-rw-r--. 1 root root    258  7月 21  2015 README.osx
-rw-rw-r--. 1 root root   2382  7月 21  2015 README.ovms
-rw-rw-r--. 1 root root   1260  7月 21  2015 README.solaris
-rw-rw-r--. 1 root root    720  7月 21  2015 README.vmware
-rw-rw-r--. 1 root root   4348  7月 21  2015 README.windows
-rw-rw-r--. 1 root root  48213  7月 21  2015 Release_Notes
-rw-rw-r--. 1 root root  14022  7月 21  2015 acinclude.m4
-rw-rw-r--. 1 root root  35422  7月 21  2015 aclocal.m4
-rwxrwxr-x. 1 root root     95  7月 21  2015 autogen.sh
-rwxrwxr-x. 1 root root  43499  7月 21  2015 config.guess
-rw-r--r--. 1 root root  11429  8月 25 20:57 config.h
-rw-rw-r--. 1 root root  10734  7月 21  2015 config.h.in
-rw-r--r--. 1 root root  95116  8月 25 20:57 config.log
-rwxr-xr-x. 1 root root  36350  8月 25 20:57 config.status
-rwxrwxr-x. 1 root root  31743  7月 21  2015 config.sub
-rwxrwxr-x. 1 root root 239279  7月 21  2015 configure
-rw-rw-r--. 1 root root  15630  7月 21  2015 configure.ac
-rwxrwxr-x. 1 root root  13866  7月 21  2015 depcomp
drwxrwxr-x. 3 root root   4096  8月 25 20:57 doc
-rw-rw-r--. 1 root root     30  7月 21  2015 inet_ntop.c
-rwxrwxr-x. 1 root root  13663  7月 21  2015 install-sh
drwxrwxr-x. 3 root root     16  7月 21  2015 m4
-rwxrwxr-x. 1 root root  10266  7月 21  2015 missing
-rwxrwxr-x. 1 root root   1988  7月 21  2015 mkinstalldirs
-rw-r--r--. 1 root root   1803  8月 25 20:57 netperf.spec
-rw-rw-r--. 1 root root   1807  7月 21  2015 netperf.spec.in
drwxrwxr-x. 6 root root   4096  8月 25 20:58 src
-rw-r--r--. 1 root root     23  8月 25 20:57 stamp-h1
[root@centosvm netperf-netperf-2.7.0]# 

configureスクリプトを実際に実行したときの出力を記載します。

[root@centosvm netperf-netperf-2.7.0]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking for an ANSI C-conforming const... yes
checking for main in -lm... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking linux/tcp.h usability... yes
checking linux/tcp.h presence... yes
checking for linux/tcp.h... yes
checking linux/socket.h usability... yes
checking linux/socket.h presence... yes
checking for linux/socket.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netinet/sctp.h usability... no
checking netinet/sctp.h presence... no
checking for netinet/sctp.h... no
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking syscall.h usability... yes
checking syscall.h presence... yes
checking for syscall.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for sys/stat.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for sys/wait.h... (cached) yes
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking sys/sysinfo.h usability... yes
checking sys/sysinfo.h presence... yes
checking for sys/sysinfo.h... yes
checking for sys/wait.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking netinet/in_systm.h usability... yes
checking netinet/in_systm.h presence... yes
checking for netinet/in_systm.h... yes
checking netinet/ip.h usability... yes
checking netinet/ip.h presence... yes
checking for netinet/ip.h... yes
checking for main in -lsocket... no
checking for main in -lmach... no
checking for an ANSI C-conforming const... (cached) yes
checking for off_t... yes
checking for size_t... yes
checking for socklen_t equivalent... unsigned
checking for h_errno declaration in netdb.h... yes
checking for struct sockaddr_storage... yes
checking whether time.h and sys/time.h may both be included... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking if sockaddr struct has sa_len member... no
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/socket.h... (cached) yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking whether setpgrp takes no argument... yes
checking return type of signal handlers... void
checking for alarm... yes
checking for bzero... yes
checking for daemon... yes
checking for gethostbyname... yes
checking for gethrtime... no
checking for gettimeofday... yes
checking for inet_ntoa... yes
checking for memset... yes
checking for memcpy... yes
checking for munmap... yes
checking for select... yes
checking for setsid... yes
checking for socket... yes
checking for sqrt... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strstr... yes
checking for strtoul... yes
checking for uname... yes
checking for toupper... yes
checking for getnameinfo... yes
checking for getaddrinfo... yes
checking for inet_ntop... yes
checking for getifaddrs... yes
checking for sendfile... yes
checking for uname... (cached) yes
checking for mpctl... no
checking for processor_bind... no
checking for sched_setaffinity... yes
checking for bind_to_cpu_id... no
checking for bindprocessor... no
checking whether to include histogram support... no
checking whether to include dirty support... no
checking whether to include demo support... no
checking whether to include Unix-domain socket tests... no
checking whether to include DLPI tests... no
checking whether to include DCCP tests... no
checking whether to include OMNI tests... yes
checking whether to include XTI tests... no
checking whether to include SDP tests... no
checking whether to include ICSC-EXS tests... no
checking whether to include SCTP tests... no
checking whether to include paced send (intervals) support... no
checking whether paced sends should spin... no
checking whether to include initial burst support in _RR tests... yes
checking which CPU utilization measurement type to use... "procstat - auto"
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/netperf_version.h
config.status: creating src/Makefile
config.status: creating src/missing/Makefile
config.status: creating src/missing/m4/Makefile
config.status: creating doc/Makefile
config.status: creating doc/examples/Makefile
config.status: creating netperf.spec
config.status: creating config.h
config.status: executing depfiles commands

./configureコマンドを実行した後に、「ls -l」コマンドでファイルを確認すると、
Makefileが作成されていることが分かります。

合計 780
-rw-rw-r--. 1 root root   8852  7月 21  2015 AUTHORS
-rw-rw-r--. 1 root root   2079  7月 21  2015 COPYING
-rw-rw-r--. 1 root root     27  7月 21  2015 ChangeLog
-rw-rw-r--. 1 root root   9240  7月 21  2015 INSTALL
-rw-r--r--. 1 root root  23623  8月 25 20:57 Makefile
-rw-rw-r--. 1 root root    120  7月 21  2015 Makefile.am
-rw-rw-r--. 1 root root  23322  7月 21  2015 Makefile.in
-rw-rw-r--. 1 root root      0  7月 21  2015 NEWS
-rw-rw-r--. 1 root root   2104  7月 21  2015 README
-rw-rw-r--. 1 root root   1673  7月 21  2015 README.aix
-rw-rw-r--. 1 root root   1772  7月 21  2015 README.hpux
-rw-rw-r--. 1 root root    258  7月 21  2015 README.osx
-rw-rw-r--. 1 root root   2382  7月 21  2015 README.ovms
-rw-rw-r--. 1 root root   1260  7月 21  2015 README.solaris
-rw-rw-r--. 1 root root    720  7月 21  2015 README.vmware
-rw-rw-r--. 1 root root   4348  7月 21  2015 README.windows
-rw-rw-r--. 1 root root  48213  7月 21  2015 Release_Notes
-rw-rw-r--. 1 root root  14022  7月 21  2015 acinclude.m4
-rw-rw-r--. 1 root root  35422  7月 21  2015 aclocal.m4
-rwxrwxr-x. 1 root root     95  7月 21  2015 autogen.sh
-rwxrwxr-x. 1 root root  43499  7月 21  2015 config.guess
-rw-r--r--. 1 root root  11429  8月 25 20:57 config.h
-rw-rw-r--. 1 root root  10734  7月 21  2015 config.h.in
-rw-r--r--. 1 root root  95116  8月 25 20:57 config.log
-rwxr-xr-x. 1 root root  36350  8月 25 20:57 config.status
-rwxrwxr-x. 1 root root  31743  7月 21  2015 config.sub
-rwxrwxr-x. 1 root root 239279  7月 21  2015 configure
-rw-rw-r--. 1 root root  15630  7月 21  2015 configure.ac
-rwxrwxr-x. 1 root root  13866  7月 21  2015 depcomp
drwxrwxr-x. 3 root root   4096  8月 25 20:57 doc
-rw-rw-r--. 1 root root     30  7月 21  2015 inet_ntop.c
-rwxrwxr-x. 1 root root  13663  7月 21  2015 install-sh
drwxrwxr-x. 3 root root     16  7月 21  2015 m4
-rwxrwxr-x. 1 root root  10266  7月 21  2015 missing
-rwxrwxr-x. 1 root root   1988  7月 21  2015 mkinstalldirs
-rw-r--r--. 1 root root   1803  8月 25 20:57 netperf.spec
-rw-rw-r--. 1 root root   1807  7月 21  2015 netperf.spec.in
drwxrwxr-x. 6 root root   4096  8月 25 20:58 src
-rw-r--r--. 1 root root     23  8月 25 20:57 stamp-h1
[root@centosvm netperf-netperf-2.7.0]# 

コンパイルの実行

次に行う作業はコンパイルという作業です。

コンパイルとは、プログラムが記載されているソースコードから、実行ファイルを作成することをコンパイルといいます。
人間が書いたプログラムを、機械が認識できるように翻訳されたファイルを作成する作業です。
機械は、この翻訳されたファイルを使用して、プログラムを実行します。

コンパイルで使用するコマンドはmakeコマンドです。
makeコマンドを実行するとコンパイルが実行されます。
その際、コンパイルに必要な処理は先ほど作成した、Makefileに記載されています。

makeコマンドをオプション無しで実行するとカレントディレクトリにある、
Makefileを読み込み、コンパイルを行います。

今回はオプション無しでmakeコマンドを使用してコンパイルを行います。

make

実際にmakeコマンドを実行したときに出力は以下です。

[root@centosvm netperf-netperf-2.7.0]# make
make  all-recursive
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' に入ります
Making all in src
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' に入ります
Making all in missing
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' に入ります
Making all in m4
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing/m4' に入ります
make[4]: `all' に対して行うべき事はありません.
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing/m4' から出ます
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' に入ります
make[4]: `all-am' に対して行うべき事はありません.
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' から出ます
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' から出ます
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' に入ります
gcc -DHAVE_CONFIG_H -I. -I..      -MT netperf.o -MD -MP -MF .deps/netperf.Tpo -c -o netperf.o netperf.c
mv -f .deps/netperf.Tpo .deps/netperf.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT netlib.o -MD -MP -MF .deps/netlib.Tpo -c -o netlib.o netlib.c
mv -f .deps/netlib.Tpo .deps/netlib.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT netsh.o -MD -MP -MF .deps/netsh.Tpo -c -o netsh.o netsh.c
mv -f .deps/netsh.Tpo .deps/netsh.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_bsd.o -MD -MP -MF .deps/nettest_bsd.Tpo -c -o nettest_bsd.o nettest_bsd.c
mv -f .deps/nettest_bsd.Tpo .deps/nettest_bsd.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_dlpi.o -MD -MP -MF .deps/nettest_dlpi.Tpo -c -o nettest_dlpi.o nettest_dlpi.c
mv -f .deps/nettest_dlpi.Tpo .deps/nettest_dlpi.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_unix.o -MD -MP -MF .deps/nettest_unix.Tpo -c -o nettest_unix.o nettest_unix.c
mv -f .deps/nettest_unix.Tpo .deps/nettest_unix.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_xti.o -MD -MP -MF .deps/nettest_xti.Tpo -c -o nettest_xti.o nettest_xti.c
mv -f .deps/nettest_xti.Tpo .deps/nettest_xti.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_sctp.o -MD -MP -MF .deps/nettest_sctp.Tpo -c -o nettest_sctp.o nettest_sctp.c
mv -f .deps/nettest_sctp.Tpo .deps/nettest_sctp.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_sdp.o -MD -MP -MF .deps/nettest_sdp.Tpo -c -o nettest_sdp.o nettest_sdp.c
mv -f .deps/nettest_sdp.Tpo .deps/nettest_sdp.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT nettest_omni.o -MD -MP -MF .deps/nettest_omni.Tpo -c -o nettest_omni.o nettest_omni.c
mv -f .deps/nettest_omni.Tpo .deps/nettest_omni.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT net_uuid.o -MD -MP -MF .deps/net_uuid.Tpo -c -o net_uuid.o net_uuid.c
mv -f .deps/net_uuid.Tpo .deps/net_uuid.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT dscp.o -MD -MP -MF .deps/dscp.Tpo -c -o dscp.o dscp.c
mv -f .deps/dscp.Tpo .deps/dscp.Po
gcc -DHAVE_CONFIG_H -I. -I..      -MT netcpu_procstat.o -MD -MP -MF .deps/netcpu_procstat.Tpo -c -o netcpu_procstat.o netcpu_procstat.c
mv -f .deps/netcpu_procstat.Tpo .deps/netcpu_procstat.Po
gcc     -o netperf netperf.o netlib.o netsh.o nettest_bsd.o nettest_dlpi.o nettest_unix.o nettest_xti.o nettest_sctp.o nettest_sdp.o nettest_omni.o net_uuid.o dscp.o netcpu_procstat.o  -lm 
gcc -DHAVE_CONFIG_H -I. -I..      -MT netserver.o -MD -MP -MF .deps/netserver.Tpo -c -o netserver.o netserver.c
mv -f .deps/netserver.Tpo .deps/netserver.Po
gcc     -o netserver netserver.o netlib.o netsh.o nettest_bsd.o nettest_dlpi.o nettest_unix.o nettest_xti.o nettest_sctp.o nettest_sdp.o nettest_omni.o net_uuid.o dscp.o netcpu_procstat.o  -lm 
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' から出ます
Making all in doc
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' に入ります
Making all in examples
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc/examples' に入ります
make[3]: `all' に対して行うべき事はありません.
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc/examples' から出ます
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' に入ります
make[3]: `all-am' に対して行うべき事はありません.
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' に入ります
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' から出ます
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' から出ます
[root@centosvm netperf-netperf-2.7.0]# 

インストールを行う

コンパイルが終了したので、次にインストールを行います。

このインストールを行うことで、実行ファイルや、ドキュメントを適切なディレクトリに配置することが出来ます。
インストールを行う際は、配置先のディレクトリに対するアクセス権があるユーザーで実行する必要があります。
※ちなみに、インストールを行わず、コンパイルを行っただけでも、実行ファイルのフルパスを指定することで、
そのプログラムを実行することが出来ます。

インストールが完了するとコマンドを入力するだけで、実行ファイルを実行することが出来るようになります。
今回の場合は、netperfをコマンドとして使用できるようになります。

インストールを行うコマンドは以下です。

make install

上記のコマンドのinstallは、オプションではなく、ターゲットといいます。
makeコマンドは、Makefileに定義されているターゲットに応じた処理を行います。

インストールが完了すると一般的なコマンドや、アプリケーションは、以下のいづれか配置されます。

・/usr/local/bin
・/usr/local/sbin

実際に実行したときに出力は以下になります。

[root@centosvm netperf-netperf-2.7.0]# make install
Making install in src
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' に入ります
Making install in missing
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' に入ります
Making install in m4
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing/m4' に入ります
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing/m4' に入ります
make[4]: `install-exec-am' に対して行うべき事はありません.
make[4]: `install-data-am' に対して行うべき事はありません.
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing/m4' から出ます
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing/m4' から出ます
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' に入ります
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' に入ります
make[4]: `install-exec-am' に対して行うべき事はありません.
make[4]: `install-data-am' に対して行うべき事はありません.
make[4]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' から出ます
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src/missing' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' に入ります
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' に入ります
test -z "/usr/local/bin" || /usr/bin/mkdir -p "/usr/local/bin"
  /usr/bin/install -c netperf netserver '/usr/local/bin'
make[3]: `install-data-am' に対して行うべき事はありません.
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' から出ます
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/src' から出ます
Making install in doc
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' に入ります
Making install in examples
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc/examples' に入ります
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc/examples' に入ります
make[3]: `install-exec-am' に対して行うべき事はありません.
make[3]: `install-data-am' に対して行うべき事はありません.
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc/examples' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc/examples' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' に入ります
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' に入ります
make[3]: `install-exec-am' に対して行うべき事はありません.
test -z "/usr/local/share/info" || /usr/bin/mkdir -p "/usr/local/share/info"
 /usr/bin/install -c -m 644 ./netperf.info '/usr/local/share/info'
 install-info --info-dir='/usr/local/share/info' '/usr/local/share/info/netperf.info'
install-info: warning: no info dir entry in `/usr/local/share/info/netperf.info'
test -z "/usr/local/share/man/man1" || /usr/bin/mkdir -p "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 'netperf.man' '/usr/local/share/man/man1/netperf.1'
 /usr/bin/install -c -m 644 'netserver.man' '/usr/local/share/man/man1/netserver.1'
make[3]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' から出ます
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' から出ます
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0/doc' から出ます
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' に入ります
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' に入ります
make[2]: `install-exec-am' に対して行うべき事はありません.
make[2]: `install-data-am' に対して行うべき事はありません.
make[2]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' から出ます
make[1]: ディレクトリ `/home/wakisaka/netperf-netperf-2.7.0' から出ます

>>サーバー側でファイアーウォールの穴あけ

Netperfのインストールが完了したので、Netperfを使用してスループット計測を行うための
準備を行います。

Netperfはデフォルトで、12865番のポートを使用します。
今回はデフォルトの12865番のポートを使用してスループットの計測を行おうと思います。

そのため、サーバー側の仮想マシンで、12865番のポートを解放する必要があります。

12865番のポートを解放する前に、すでに12865番のポートが解放されていないか確認します。

下記のコマンドを実行し、

「ports:」の項目で12865番ポートが記載されていなければまだポートの解放はされていない状況です。

firewall-cmd --list-all

実際に実行したときの出力は以下です。

[root@goritarou ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

「ports:」の項目で何も記載されていないことから、12865番ポートはまだ解放されていないことが分かります。

次に実際に12865番ポートを解放するコマンドを出力します。

firewall-cmd --zone=public --add-port=12865/tcp --permanent

実際に実行したときの出力は以下です。

[root@centosvm ~]# firewall-cmd --zone=public --add-port=12865/tcp --permanent
success
[root@centosvm ~]# 

ファイアウォールの設定を変更したため、変更後の設定を読み込ませるために、
ファイアウォールを再起動させます。
※再起動させないと、設定の変更がシステムに反映されません。

systemctl restart firewalld.service

実際に実行したときの出力は以下です。

※再起動が成功しても特に何も表示されません。

[root@centosvm ~]# systemctl restart firewalld.service
[root@centosvm ~]# 

最後に、12865番のポートが解放されているか確認します。

firewall-cmd --list-all

以下が実行したときの出力です。

「ports:」の項目でtcpの12865番ポートが解放されたことが確認できます。

[root@centosvm ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: dhcpv6-client ssh
  ports: 12865/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
	
[root@centosvm ~]# 

>>サーバー側でサーバー機能(netserver)を実行

次にサーバー機能を、サーバー側の仮想マシンで実行するために以下のコマンドを使用します。

netserver

実際に実行したときの出力は以下です。

[root@centosvm ~]# netserver 
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
[root@centosvm ~]# 

ちなみに、netserverを終了するときは以下のコマンドを使用します。

killall netserver

>>クライアント側でNetperfコマンドの実行

これでようやくスループットの計測の準備が整いました。
実際にクライアント側の仮想マシンで、Netperコマンドを使用して、
スループットの計測を行います。

使用するコマンドは以下です。

netperf -H 相手のIPアドレス -p ポート番号
※相手のIPアドレスには、通信先のサーバー側の仮想マシンのIPアドレスを指定します。
※ポート番号には、使用するポート番号を指定します。今回はデフォルトの12865です。

実際に実行したときの出力は以下です。

[root@centosvm src]# netperf -H 192.168.74.143 -p 12865
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.74.143 () port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  16384    10.00    9349.79   

上記の「Throughput」の項目でスループットが確認できます。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA