[Lubuntu] CLI でインターネットスピードを計測できる iperf をインストールする。

プロバイダーのオプションプランで固定グローバル IP サービスを申し込んで以降、ヤマハの RTX1100 にそのグローバル IP を静的に設定し、いろんなサイトのインターネットのスピード測定を利用してみたのですが、スピードがかなり遅くなったように感じます。

プロバイダーに連絡して固定グローバル IP を使用する場合、ネットワーク構成の違い等の理由からスピードに違いがあるのかないのかを確認しても良いのですが、その前に自分で調べてみようと思い立ちました。

ほんの数回、数十回の計測ではデータとしてあてにならないので最低千回くらいの測定を行って比較してみようと思います。これを実現するには CLI で速度測定を行い、それを自動でログに記録していく必要があります。固定グローバル IP を使う場合と使わない場合の2つのパターンで行って比較するのでなおさらですね。

そこでどんな CLI ツールがあるかググったところ、iperf というのがあるらしいので、これを Lubuntu にインストールすることにしました。

iperf の情報を aptitude コマンドで調べていきます。最初に aptitude search で iperf という文字列を含むパッケージを検索します。

$ aptitude search iperf
p iperf – Internet Protocol bandwidth measuring tool
$

iperf というパッケージが見つかりました。詳細情報を見る場合は、aptitude show を実行します。

$ aptitude show iperf
パッケージ: iperf
状態: インストールされていません
バージョン: 2.0.5-3
優先度: 任意
セクション: universe/net
メンテナ: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
アーキテクチャ: i386
展開サイズ: 169 k
依存: libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1)
説明: Internet Protocol bandwidth measuring tool
Iperf is a modern alternative for measuring TCP and UDP bandwidth performance, allowing the tuning of various
parameters and characteristics.Features:
* Measure bandwidth, packet loss, delay jitter
* Report MSS/MTU size and observed read sizes.
* Support for TCP window size via socket buffers.
* Multi-threaded. Client and server can have multiple simultaneous connections.
* Client can create UDP streams of specified bandwidth.
* Multicast and IPv6 capable.
* Options can be specified with K (kilo-) and M (mega-) suffices.
* Can run for specified time, rather than a set amount of data to transfer.
* Picks the best units for the size of data being reported.
* Server handles multiple connections.
* Print periodic, intermediate bandwidth, jitter, and loss reports at specified intervals.
* Server can be run as a daemon.
* Use representative streams to test out how link layer compression affects your achievable bandwidth.
ホームページ: http://iperf.sourceforge.net/
$

「インストールされていません」と表示されていますので、iperf を使うためにはインストールが必要です。aptitude install でインストールしてみます。

$ sudo aptitude install iperf
以下の新規パッケージがインストールされます:
iperf
0 個のパッケージを更新、 1 個を新たにインストール、 0 個を削除予定、52 個が更新されていない。
54.4 k バイトのアーカイブを取得する必要があります。 展開後に 169 k バイトのディスク領域が新たに消費されます。
取得: 1 http://jp.archive.ubuntu.com/ubuntu/ saucy/universe iperf i386 2.0.5-3 [54.4 kB]
Fetched 54.4 kB in 0秒 (182 kB/s)
以前に未選択のパッケージ iperf を選択しています。
(データベースを読み込んでいます … 現在 162321 個のファイルとディレクトリがインストールされています。)
(…/iperf_2.0.5-3_i386.deb から) iperf を展開しています…
man-db のトリガを処理しています …
iperf (2.0.5-3) を設定しています …
$

aptitude を使ってインストールが完了しました。aptitude の詳細な使用方法は aptitude -h でヘルプを表示するか man aptitude でマニュアルを読めばよいでしょう。

which で iperf がどこにインストールされたか確認してみます。

$ which iperf
/usr/bin/iperf
$

/usr/bin にインストールされていますね。ヘルプを表示させてみると使い方についての情報が表示されます。

$ iperf -h
Usage: iperf [-s|-c host] [options]
iperf [-h|–help] [-v|–version]Client/Server:
-f, –format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes
-i, –interval # seconds between periodic bandwidth reports
-l, –len #[KM] length of buffer to read or write (default 8 KB)
-m, –print_mss print TCP maximum segment size (MTU – TCP/IP header)
-o, –output output the report or error message to this specified file
-p, –port # server port to listen on/connect to
-u, –udp use UDP rather than TCP
-w, –window #[KM] TCP window size (socket buffer size)
-B, –bind bind to , an interface or multicast address
-C, –compatibility for use with older versions does not sent extra msgs
-M, –mss # set TCP maximum segment size (MTU – 40 bytes)
-N, –nodelay set TCP no delay, disabling Nagle’s Algorithm
-V, –IPv6Version Set the domain to IPv6Server specific:
-s, –server run in server mode
-U, –single_udp run in single threaded UDP mode
-D, –daemon run the server as a daemon

Client specific:
-b, –bandwidth #[KM] for UDP, bandwidth to send at in bits/sec
(default 1 Mbit/sec, implies -u)
-c, –client run in client mode, connecting to
-d, –dualtest Do a bidirectional test simultaneously
-n, –num #[KM] number of bytes to transmit (instead of -t)
-r, –tradeoff Do a bidirectional test individually
-t, –time # time in seconds to transmit for (default 10 secs)
-F, –fileinput input the data to be transmitted from a file
-I, –stdin input the data to be transmitted from stdin
-L, –listenport # port to receive bidirectional tests back on
-P, –parallel # number of parallel client threads to run
-T, –ttl # time-to-live, for multicast (default 1)
-Z, –linux-congestion set TCP congestion control algorithm (Linux only)

Miscellaneous:
-x, –reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports
-y, –reportstyle C report as a Comma-Separated Values
-h, –help print this message and quit
-v, –version print version information and quit

[KM] Indicates options that support a K or M suffix for kilo- or mega-

The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_, such as IPERF_BANDWIDTH.

Report bugs to <iperf-users@lists.sourceforge.net>
$

これだけたくさんのオプションがあるとできることは非常に幅広そうです。

コメントを残す

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

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください