系统测试网速工具

如何测试服务器网速,官方测试工具speedtest-cli (opens new window),开源测试工具speedtest-cli (opens new window)

# 获取方式

    brew tap teamookla/speedtest
    brew update
    brew install speedtest --force
    
    1
    2
    3
    sudo apt-get install gnupg1 apt-transport-https dirmngr
    export INSTALL_KEY=379CE192D401AB61
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
    echo "deb https://ookla.bintray.com/debian generic main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
    sudo apt-get update
    # Other non-official binaries will conflict with Speedtest CLI
    # Example how to remove using apt-get
    # sudo apt-get remove speedtest-cli
    sudo apt-get install speedtest
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    sudo yum install wget
    wget https://bintray.com/ookla/rhel/rpm -O bintray-ookla-rhel.repo
    sudo mv bintray-ookla-rhel.repo /etc/yum.repos.d/
    # Other non-official binaries will conflict with Speedtest CLI
    # Example how to remove using yum
    # rpm -qa | grep speedtest | xargs -I {} sudo yum -y remove {}
    sudo yum install speedtest
    
    1
    2
    3
    4
    5
    6
    7
    // Make sure to add code blocks to your code group

    # 使用

    常用服务器 ID
    上海电信 3633
    上海联通 24447
    上海移动 25637
    [root@ ~]# speedtest -s 3633
    
       Speedtest by Ookla
    
         Server: China Telecom - Shanghai (id = 3633)
            ISP: Amazon.com
        Latency:    65.73 ms   (3.52 ms jitter)
       Download:   473.29 Mbps (data used: 737.1 MB)
         Upload:   284.78 Mbps (data used: 274.9 MB)
    Packet Loss: Not available.
     Result URL: https://www.speedtest.net/
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    [root@ ~]# speedtest -h
    
    Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.
    
    Version: speedtest 1.0.0.2
    
    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)
      -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
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40