Upgrade to Pro — share decks privately, control downloads, hide ads and more …

cliでspeedtestできるspeedtest-cli

 cliでspeedtestできるspeedtest-cli

Kenichiro MATOHARA

December 09, 2017
Tweet

More Decks by Kenichiro MATOHARA

Other Decks in Technology

Transcript

  1. matoken?
    KenichiroMATOHARA( @matoken )
    http://matoken.org
    興味
    PC-UNIX/OSS, OpenStreetMap, 電⼦⼯作, ⾃転⾞……
    altanativeが好き,多様性は正義!

    View full-size slide

  2. ⼤隅から来ました

    View full-size slide

  3. 最近
    ⾃宅⽤にAPを購⼊ BAFFALO WZR-HP-AG H
    ハードオフ⿅屋店にて本体のみのジャンク218円
    よくあるセンターポジティブの12V A . mmで動いた
    . GHz bgn Mb → . + GHz abgn Mbに!
    KRACKsとかの対応は多分出ないくらいの古さ
    OpenWrtとかLEDEとかいけるぽい

    View full-size slide

  4. きっかけ
    orumin @orumin そういえば speedtest.net って Linux の CLI client もありますね。
    ってことでLinuxのcliで動くPython製のspeedtest-cliをちょっと試して
    みた.

    View full-size slide

  5. speedtest-cli
    GitHub - sivel/speedtest-cli: Command line interface for testing internet bandwidth using
    speedtest.net
    speedtest.netでの回線速度計測をcliで⾏える
    python製でpipとかで各種環境に導⼊可能

    View full-size slide

  6. パッケージから導⼊
    Debian — パッケージ検索結果 — speedtest-cli
    Ubuntu ‒ パッケージ検索結果 — speedtest-cli
    規定値の動作はipからロケーション拾ってそこから近いサーバーで計測
    した結果を返すようです. ⾃宅のipアドレスでの⾃動判定では静岡にな
    ってたので⼿動で計測サーバを変更して⿅児島と東京を試しました.
    $ sudo apt install speedtest-cli

    View full-size slide

  7. $ speedtest-cli -h
    usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
    [--server SERVER] [--mini MINI] [--source SOURCE]
    [--timeout TIMEOUT] [--secure] [--version]
    Command line interface for testing internet bandwidth using speedtest.net.
    --------------------------------------------------------------------------
    https://github.com/sivel/speedtest-cli
    optional arguments:
    -h, --help show this help message and exit
    --bytes Display values in bytes instead of bits. Does not affect
    the image generated by --share
    --share Generate and provide a URL to the speedtest.net share
    results image
    --simple Suppress verbose output, only show basic information
    --list Display a list of speedtest.net servers sorted by
    distance
    --server SERVER Specify a server ID to test against
    --mini MINI URL of the Speedtest Mini server
    --source SOURCE Source IP address to bind to
    --timeout TIMEOUT HTTP timeout in seconds. Default 10
    --secure Use HTTPS instead of HTTP when communicating with
    speedtest.net operated servers
    --version Show the version number and exit

    View full-size slide

  8. 実際に計測
    規定値では⾃宅は静岡になっていて静岡サーバで計測する(実際は⿅児
    島)
    $ speedtest-cli
    Retrieving speedtest.net configuration...
    Retrieving speedtest.net server list...
    Testing from FreeBit (180.131.110.140)...
    Selecting best server based on latency...
    Hosted by ClickL Network (Shizuoka) [0.02 km]: 110.464 ms
    Testing download speed........................................
    Download: 2.07 Mbit/s
    Testing upload speed..................................................
    Upload: 0.92 Mbit/s

    View full-size slide

  9. ⽇本のサーバを確認する
    $ speedtest-cli --list|grep -i japan
    14180) ClickL Network (Shizuoka, Japan) [0.02 km]
    8407) Allied Telesis Capital Corporation (Sagamihara, Japan) [111.58 km]
    6087) Allied Telesis Capital Corporation (Fussa-shi, Japan) [120.41 km]
    6508) at2wn (Yokohama, Japan) [125.30 km]
    7510) ASEINet (Tokyo, Japan) [141.71 km]
    12546) TB (Tokyo, Japan) [141.71 km]
    12511) h3zjp (Nerima, Japan) [142.66 km]
    8348) Foxcore-LS (Sodegaura, Japan) [167.71 km]
    7139) SoftEther Corporation (Tsukuba, Japan) [192.41 km]
    6368) gatolabo (Maibara, Japan) [194.62 km]
    6766) JAIST(ino-lab) (Nomi, Japan) [232.28 km]
    13641) NextechNetworkSolutions (Nara, Japan) [237.53 km]
    6476) rxy (individual) (Osaka, Japan) [264.80 km]
    8832) prize3046 (Ikeda, Japan) [269.86 km]
    8193) kamiari (Sendai, Japan) [427.67 km]
    7976) denpa893 (Hikari, Japan) [601.03 km]
    6405) Allied Telesis Capital Corporation (Misawa, Japan) [686.38 km]
    13568) KSL (Kagoshima, Japan) [820.38 km]
    811) GLBB Japan KK (Chatan, Japan) [1397.84 km]
    6581) haza (Haebaru, Japan) [1410.56 km]

    View full-size slide

  10. ⿅児島サーバで計測して
    みる
    ※現在はなくなっている
    $ speedtest-cli --server 13568
    Retrieving speedtest.net configuration...
    Retrieving speedtest.net server list...
    Testing from FreeBit (180.131.110.140)...
    Hosted by KSL (Kagoshima) [820.38 km]: 103.499 ms
    Testing download speed........................................
    Download: 2.20 Mbit/s
    Testing upload speed..................................................
    Upload: 0.92 Mbit/s

    View full-size slide

  11. 東京を‒simple option
    で計測してみる
    $ speedtest-cli --simple --server 7510
    Ping: 150.627 ms
    Download: 1.88 Mbit/s
    Upload: 0.84 Mbit/s

    View full-size slide

  12. サーバの数を確認してみ

    $ speedtest-cli --list | wc -l
    6509

    View full-size slide

  13. まとめ
    speedtestはJavaScriptやAdobe Flashが必要なことが多くてヘッドレス環境などでは⾯倒でした.
    iperfやnetcatなんかはお⼿軽ですが,速度テスト先のサーバの⽤意が必要です.
    今回のspeedtest-cliはお⼿軽に導⼊できて世界各地のサーバ相⼿にcliでspeed testも出来ていい感じで
    す.

    View full-size slide

  14. license等
    Copyright: Kenichiro MATOHARA
    License : https://creativecommons.org/licenses/by-nc-sa/ . /(CC BY-NC-SA 4.0)
    source : https://bitbucket.org/matoken/kagolug- . /src
    - - (Sat) ⿅児島Linux勉強会 2017.12にて発表

    View full-size slide