Liunx下如何使用SpeedTest测试服务器

2,537次阅读

共计 1530 个字符,预计需要花费 4 分钟才能阅读完成。

Speedtest-cli 是什么

此程序是基于 Python 开发的脚本程序,利用了 speedtest.net 的服务来测量出上下行的宽带。Speedtest-cli 能根据机房离测速服务器的物理距离来列出测速服务器,或者针对某一服务器进行测速,同时还能为你生成一个 URL 以便你分享你的测速结果。

要在 Linux 上安装最新版本的 speedtest-cli, 你必须安装 2.4-3.4 或者更高版本的 Python

简单食用方法

下载测试脚本

wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py

为脚本添加权限

chmod a rx speedtest.py

然后运行脚本

python speedtest.py
Liunx 下如何使用 SpeedTest 测试服务器

在默认情况下,SpeedTest 是选择离测试机最近的一个节点进行测试的,如果你想要自定义测试到某个地区的上传 / 下载速率,那首先列出目前可用的 SpeedTest 服务器:

python speedtest.py --list

此时会列出所有的服务器(按照距离远近进行排列)

如果想一点一点的列出服务器,请输入:

python speedtest.py --list|more

可以看到每个地区前面有一个数字

root@10-8-186-77:~# python speedtest.py --list|more
Retrieving speedtest.net configuration...
22126) i3D.net (Hong Kong, Hong Kong) [0.00 km]
 1536) STC (Hong Kong, China) [0.00 km]
21182) Gemnet LLC (Hong Kong, Hong Kong) [0.00 km]
 2993) Website Solution Limited (Hong Kong, China) [0.00 km]
21805) GIAM PING VIETPN.COM (Hong Kong, Hong Kong) [0.00 km]
12990) QTS Data Centers (Hong Kong, China) [0.00 km]
23966) DMIT Inc. (Hong Kong, Hong Kong) [0.00 km]
24375) GTT.net (Hong Kong, Hong Kong) [0.00 km]
25943) netX.HK (Hong Kong, Hong Kong) [0.00 km]
23841) Dataplugs.com (Hong Kong, Hong Kong) [0.00 km]
18745) FPT Telecom (Chai Wan, Hong Kong) [7.86 km]
13538) CSL (Kwai Chung, Hong Kong) [13.52 km]
14429) W Professional Services Limited (New Territories, Hong Kong) [14.11 km]
16176) HGC Global Communications Limited (Shatin, Hong Kong) [14.48 km]
14903) CSL (Tai Po, Hong Kong) [21.38 km]
 4515) China Mobile,Guangdong (Shenzhen, China) [31.69 km]
25177) CTM (Taipa, Macau) [62.86 km]

如果你想列出指定地区的测试节点,可以使用

python speedtest.py --list | grep China

如果我们想测试主机到 Gemnet LLC 个节点的速率,那么是这样输入:

python speedtest.py --server 21182

教程非常简单,码此文章仅用于备份,毕竟记性不是很好。
部分内容和代码来源于互联网,感谢大佬们的搜集和总结。

正文完
 
Blood.Cold
版权声明:本站原创文章,由 Blood.Cold 2019-08-21发表,共计1530字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。