speedtest.net公式ツールを使って、Linuxのコマンドラインでスピードテストを実施する

背景

VPS のスペック比較のために CLI でスピードテストを実施したいと考えました。

しかし、調べたところ、どこもかしこも、以下の非公式ツールを使用した手順を紹介しているのですが、これは誤りです。

いえ、誤りというよりは推奨されません。現時点で4年間もメンテナンスされていませんし、スピードも計測時間が短いために不正確な数字が表示されます。

GitHub - sivel/speedtest-cli: Command line interface for testing internet bandwidth using speedtest.net
Command line interface for testing internet bandwidth using speedtest.net - GitHub - sivel/speedtest-cli: Command line interface for testing internet bandwidth ...

現在は speedtest.net 公式の CLI ツールが用意されており、そちらを使用する方法が推奨されます。

念のため、ここで紹介しておきます。

環境

Rocky Linux 9

手順

手順は簡単で、公式サイトの手順通りに実施するだけです。

ここでは CentOS 系の手順を掲載しますが、そのほかの環境での手順も公式に記載されています。

Speedtest CLI:コマンドライン用のインターネット速度テスト
Speedtest CLIを使えば、 Speedtestで使われている信頼できるテクノロジーとグローバルサーバーネットワークをコマンドラインで使用できるようになります。

speedtest.net のリポジトリを登録

curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh | sudo bash

インストール

yum install speedtest -y

これだけです。

使い方

使い方も簡単で、コマンドを実行するだけで使用できます。

speedtest

実行例:

$ speedtest 

   Speedtest by Ookla

      Server: Speedtest.love - Tokyo (id: 53189)
         ISP: Xserver
Idle Latency:     0.53 ms   (jitter: 0.12ms, low: 0.47ms, high: 0.75ms)
    Download:  3131.37 Mbps (data used: 4.9 GB)                                                   
                 35.33 ms   (jitter: 7.57ms, low: 0.47ms, high: 142.86ms)
      Upload:    99.70 Mbps (data used: 150.6 MB)                                                   
                  0.72 ms   (jitter: 0.93ms, low: 0.47ms, high: 30.48ms)
 Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/f31c2714-7256-4a83-9763-d3f7dde9c858

サーバーを指定して実行

[test@aaaaaaaaaa ~]$ speedtest -L
Closest servers:

    ID  Name                           Location             Country
==============================================================================
 21569  i3D.net                        Tokyo                Japan
 38241  BudgetVM                       Tokyo                Japan
 20976  GLBB Japan                     Tokyo                Japan
 28910  fdcservers.net                 Tokyo                Japan
 24333  Rakuten Mobile, Inc            Tokyo                Japan
 50686  GSL Networks                   Tokyo                Japan
 50467  Verizon                        Tokyo                Japan
 50959  Osaka Electro-Communication University | Communication Research Club Tokyo                Japan
 53189  Speedtest.love                 Tokyo                Japan
 44988  Misaka Network, Inc.           Tokyo                Japan
[test@aaaaaaaaaa ~]$
[test@aaaaaaaaaa ~]$ speedtest -s 21569

   Speedtest by Ookla

      Server: i3D.net - Tokyo (id: 21569)
         ISP: Xserver
Idle Latency:     8.28 ms   (jitter: 0.04ms, low: 8.26ms, high: 8.38ms)
    Download:  9358.71 Mbps (data used: 9.6 GB)                                                   
                 11.46 ms   (jitter: 0.57ms, low: 8.35ms, high: 24.80ms)
      Upload:    98.44 Mbps (data used: 156.4 MB)                                                   
                  8.27 ms   (jitter: 0.06ms, low: 8.19ms, high: 9.09ms)
 Packet Loss:     4.2%
  Result URL: https://www.speedtest.net/result/c/210c2598-6ff5-44bf-ab52-01a4049955d2

ヘルプ:

$ speedtest -h
Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.

Version: speedtest 1.2.0.84

Usage: speedtest [<options>]
  -h, --help                        Print usage information
  -V, --version                     Print version number
  -L, --servers                     List nearest servers
  -s, --server-id=#                 Specify a server from the server list using its id
  -I, --interface=ARG               Attempt to bind to the specified interface when connecting to servers
  -i, --ip=ARG                      Attempt to bind to the specified IP address when connecting to servers
  -o, --host=ARG                    Specify a server, from the server list, using its host's fully qualified domain name
  -p, --progress=yes|no             Enable or disable progress bar (Note: only available for 'human-readable'
                                    or 'json' and defaults to yes when interactive)
  -P, --precision=#                 Number of decimals to use (0-8, default=2)
  -f, --format=ARG                  Output format (see below for valid formats)
      --progress-update-interval=#  Progress update interval (100-1000 milliseconds)
  -u, --unit[=ARG]                  Output unit for displaying speeds (Note: this is only applicable
                                    for ‘human-readable’ output format and the default unit is Mbps)
  -a                                Shortcut for [-u auto-decimal-bits]
  -A                                Shortcut for [-u auto-decimal-bytes]
  -b                                Shortcut for [-u auto-binary-bits]
  -B                                Shortcut for [-u auto-binary-bytes]
      --selection-details           Show server selection details
      --ca-certificate=ARG          CA Certificate bundle path
  -v                                Logging verbosity. Specify multiple times for higher verbosity
      --output-header               Show output header for CSV and TSV formats

 Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty

 Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision

 Valid units for [-u] flag: 
   Decimal prefix, bits per second:  bps, kbps, Mbps, Gbps
   Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
   Binary prefix, bits per second:   kibps, Mibps, Gibps
   Binary prefix, bytes per second:  kiB/s, MiB/s, GiB/s
   Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes

以上、参考になれば幸いです。

コメント

タイトルとURLをコピーしました