我们经常需要检查服务器的当地或指定地点的网络状况,于是便了有此文的主题Speedtest-CLI,这是个十分好用的工具,使用简单的命令就能达到我们的目的。

1.什么是Speedtest-CLI

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

2.安装Speedtest-CLI

wget -O speedtest-cli --no-check-certificate https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

3.使用Speedtest-CLI

最简单的使用方法,直接启动脚本,脚本会按照IP自动选择节点测速

./speedtest-cli

但是这种方法并不准确,因为现在很多服务提供商为了节约成本而使用广播IP。所以会出现默认测速节点太远的情况,这时候就需要你手动查找节点并使用了。
查找中国所有节点:

./speedtest-cli --list | grep China       #查找节点

Speedtest 在发布时中国的所有节点如下:

17245) China Mobile Group XinJiang (Kashi, China) [3336.15 km]
17222) China Mobile Group XinJiang (Aletai, China) [3500.11 km]
 6144) xjunicom (Urumqi, China) [3733.08 km]
16858) China Mobile Group XinJiang (Urumqi, China) [3733.08 km]
17227) China Mobile Group XinJiang (Hetian, China) [3762.06 km]
 5750) Lhasaunicom (Lhasa, China) [5068.14 km]
17230) China Mobile Communications Group Inner Mongolia Co., Ltd. (Alxa, China) [5227.66 km]
16392) Yinchuan,China Mobile,Ningxia (Yinchuan, China) [5290.98 km]
 3973) China Telecom (Lanzhou, China) [5330.35 km]
16145) Lanzhou,China Mobile,Gansu (Lanzhou, China) [5330.35 km]
 4690) China Unicom Lanzhou Branch Co.Ltd (Lanzhou, China) [5330.35 km]
 5509) Chinaunicom Ningxia branch (Ningxia, China) [5379.76 km]
 5465) China Unicom (Hohhot, China) [5437.66 km]
16005) Shanxi CMCC (Taiyuan, China) [5724.90 km]
12868) China unicom shanxi branch (Taiyuan, China) [5724.90 km]
 4575) China Mobile Group Sichuan (Chengdu, China) [5788.53 km]
 4624) ChinaTelecom (Chengdu, China) [5788.53 km]
11444) University of Electronic Science and Technology of China (Chengdu, China) [5788.53 km]
 2461) China Unicom (Chengdu, China) [5788.53 km]
 5292) China Mobile Group Shaanxi Company Limited (Xi'an, China) [5791.01 km]
 4863) Xi'an branch,Chinaunicom (Xi'an, China) [5791.01 km]
 4713) China Mobile Group Beijing Co.Ltd (Beijing, China) [5793.30 km]
 4751) Beijing Telecom (Beijing, China) [5793.30 km]
 5145) Beijing Unicom (Beijing, China) [5793.30 km]
 5505) Beijing Broadband Network (Beijing, China) [5793.30 km]
17184) China Mobile,TianJin (Tianjin, CN) [5902.87 km]
 5475) China Unicom (Tianjin, China) [5902.87 km]
17437) China Mobile Heilongjiang branch (Harbin, China) [5908.67 km]
 5460) China Unicom Heilongjiang Branch (Harbin, China) [5918.29 km]
 9484) China Unicom (Changchun, China) [5994.60 km]
10742) Changchun Unicom (Changchun, China) [5994.60 km]
 5726) China Unicom Chong Qing Branch (Chongqing, China) [6038.04 km]
 5530) CCN (Chongqing, China) [6038.04 km]
 5131) China unicom henan branch (Zhengzhou, China) [6043.46 km]
16167) ChinaMobile, Liaoning Branch (Shenyang, China) [6085.62 km]
 5017) China Unicom,Liaoning Branch (Shenyang, China) [6085.62 km]
16314) China Mobile, shandong Branch (Jinan, China) [6090.71 km]
 5039) China unicom Jinan branch (Jinan, China) [6090.71 km]
 5563) JINAN Wo China company (Jinan, China) [6090.71 km]
12538) SHANDONG UNICOM (Jinan, China) [6090.71 km]
 6435) china Telecom hubei branch (Xiangyang, China) [6178.12 km]
12637) China Telecom Xiangyang Branch (XiangYang, China) [6178.12 km]
 5103) Yunnan Chinaunicom (Kunming, China) [6181.78 km]
 6168) China Telecom (Kunming, China) [6181.78 km]
16398) China Mobile,GuiZhou (Guiyang, China) [6291.14 km]
17388) Chinamobile (Linyi, China) [6302.48 km]
 5396) China Telecom JiangSu Branch (Suzhou, China) [6303.15 km]
16395) China Mobile (Wuhan, China) [6432.22 km]
 5485) China Unicom,Hubei Branch (Wuhan, China) [6432.22 km]
17145) China Telecom AnHui Branch (Hefei, CN) [6508.51 km]
 4377) China Mobile Group Anhui Co.,Ltd (Hefei, China) [6508.51 km]
 5724) ChinaUnicom (Hefei, China) [6508.51 km]
 6132) ChinaTelecom.Hunan (Changsha, China) [6554.38 km]
 4870) Changsha, Hunan Unicom (Changsha, China) [6554.38 km]
15862) China Mobile Group Hunan Co.,Ltd (Changsha, China) [6554.38 km]
 5446) CHINA UNICOM JIANGSU COMPANY (Nanjing, China) [6583.74 km]
 5316) China Telecom JiangSu Branch (Nanjing, China) [6583.74 km]
13704) China Unicom (Nanjing, China) [6584.72 km]
17320) ZhenJiang branch,China Mobile Limited (ZhenJiang, China) [6612.03 km]
16399) CHINATelecom.JX (Nanchang, China) [6693.49 km]
 7230) China Unicom.JiangXi Co.,Ltd (Nanchang, China) [6693.49 km]
16294) China Mobile Group JiangXi Co.Ltd (Nanchang, China) [6693.49 km]
16332) China Mobile Group JiangXi CO.,Ltd (Nanchang, China) [6693.49 km]
 5097) Chinaunicom.jx (Nanchang, China) [6693.49 km]
10305) GX-Telecom (Nanning, China) [6730.98 km]
 5674) GX-Unicom (Nanning, China) [6730.98 km]
15863) GX ChinaMobile (Nanning, China) [6730.98 km]
17019) CoreLink Inc, (Shanghai, China) [6822.48 km]
16719) China Mobile Communications Corporation Shanghai Company Limited (Shanghai, China) [6822.48 km]
16803) China Mobile Communications Corporation Shanghai Company Limited (Shanghai, China) [6822.48 km]
 5083) Shanghai Branch, China Unicom (Shanghai, China) [6822.48 km]
 3633) China Telecom (Shanghai, China) [6822.48 km]
 4665) China Mobile Group Shanghai Co.,LTD (Shanghai, China) [6822.48 km]
 7509) China Telecom ZheJiang Branch (Hangzhou, China) [6822.73 km]
 5300) Hangzhou , Zhejiang Unicom (Hangzhou, China) [6822.73 km]
 4647) China Mobile Group Zhejiang Co.,Ltd (Hangzhou, China) [6822.73 km]
 6245) ningbo unicom (Ningbo, China) [6940.08 km]
17251) ChinaTelecom-GZ (Guangzhou, CN) [7012.91 km]
 6611) China Mobile,Guangdong (Guangzhou, China) [7012.91 km]
16503) Chinamobile,Hainan (Haikou, China) [7103.37 km]
 5081) ShenZhen Telecom (Shenzhen, China) [7119.97 km]
 4515) China Mobile,Guangdong (Shenzhen, China) [7119.97 km]
16171) Fuzhou China Mobile,Fujian (Fuzhou, China) [7131.22 km]
 4884) China Unicom FuJian (Fuzhou, China) [7131.22 km]
 2993) Website Solution Limited (Hong Kong, China) [7147.06 km]
12990) QTS Data Centers (Hong Kong, China) [7147.06 km]
10267) Interoute VDC (Hong Kong, China) [7147.06 km]
 1536) STC (Hong Kong, China) [7147.06 km]
 8170) Atombase Global Datamation (Hong Kong, China) [7147.06 km]
 6852) FPT Telecom (Chai Wan, China) [7149.88 km]

指定一个speedtest测试节点:

./speedtest-cli --server XXXX     #选择并使用节点

0 条评论

发表评论