首页 » 教程 » 正文

speedtest-cli 测试VPS外网上传下载速度

speedtest是一个使用python编写的命令行脚本,通过调用speedtest.net测试上下行的接口来完成速度测试。

下载命令

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

使用方法

1、列出所有在中国的测试服务器:

root@vpsyh:~# ./speedtest-cli --list | grep China
5985) Hainan Unicom (Haikou, China) [6898.27 km]
6852) FPT Telecom (Chai Wan, China) [6918.85 km]
2993) Website Solution Limited (Hong Kong, China) [6920.32 km]
8648) China Broadband Communications (Hong Kong, China) [6920.32 km]
1536) STC (Hong Kong, China) [6923.49 km]
8170) Atombase Global Datamation (Hong Kong, China) [6923.70 km]
5081) ShenZhen Telecom (Shenzhen, China) [6953.12 km]
5506) china unicom (Xiamen, China) [6971.27 km]
9151) ChinaTelecom-GZ (Guangzhou, China) [7050.07 km]
3891) Unicom-GZ (Guangzhou, China) [7050.07 km]
4884) China Unicom FuJian (Fuzhou, China) [7089.07 km]
5674) GX-Unicom (Nanning, China) [7270.68 km]
6245) ningbo unicom (Ningbo, China) [7404.48 km]
6345) ChinaTelecom.JiangXi (Nanchang, China) [7489.05 km]
7643) China Telecom.JiangXi.Network Center (Nanchang, China) [7489.05 km]
6473) jxtelecom (Nanchang, China) [7489.05 km]
5097) Chinaunicom.jx (Nanchang, China) [7489.05 km]
7230) China Unicom.JiangXi Co.,Ltd (Nanchang, China) [7489.05 km]
7509) China Telecom ZheJiang Branch (Hangzhou, China) [7490.36 km]
5300) Hangzhou , Zhejiang Unicom (Hangzhou, China) [7490.36 km]
8173) 5UFVPN (Hangzhou, China) [7490.36 km]
5083) Shanghai Branch, China Unicom (Shanghai, China) [7545.81 km]
6132) ChinaTelecom.Hunan (Changsha, China) [7563.79 km]
4870) Changsha, Hunan Unicom (Changsha, China) [7563.79 km]
3927) China Mobile Jiangsu Co., Ltd. (Suzhou, China) [7587.03 km]
5122) China Mobile Group Jiangsu Co.,Ltd. (Wuxi, China) [7622.98 km]
7404) GuiYang Mobile Group chor (Guiyang, China) [7722.45 km]
5446) CHINA UNICOM JIANGSU COMPANY (Nanjing, China) [7725.11 km]
5316) China Telecom JiangSu Branch (Nanjing, China) [7725.11 km]
5485) China Unicom,Hubei Branch (Wuhan, China) [7745.87 km]
5724) ChinaUnicom (Hefei, China) [7759.22 km]
4377) China Mobile Group Anhui Co.,Ltd (Hefei, China) [7759.22 km]
6168) China Telecom (Kunming, China) [7794.80 km]
6435) china Telecom hubei branch (Xiangyang, China) [7979.13 km]
6592) China Telecom Chongqing (Chongqing, China) [8000.73 km]
5726) China Unicom Chong Qing Branch (Chongqing, China) [8000.73 km]
5530) CCN (Chongqing, China) [8000.73 km]
4595) China Telecom HeNan Branch (Zhengzhou, China) [8191.44 km]
4486) China Mobile Group Henan Co.,Ltd. (Zhengzhou, China) [8191.44 km]
5131) China unicom henan branch (Zhengzhou, China) [8191.44 km]
4624) ChinaTelecom (Chengdu, China) [8232.94 km]
4575) China Mobile Group Sichuan (Chengdu, China) [8232.94 km]
2461) China Unicom (Chengdu, China) [8233.12 km]
5039) China unicom Jinan branch (Jinan, China) [8262.34 km]
4863) Xi'an branch,Chinaunicom (Xi'an, China) [8341.37 km]
5292) China Mobile Group Shaanxi Company Limited (Xi'an, China) [8341.37 km]
6714) Tianjin Telecom (Tianjin, China) [8509.43 km]
5017) China Unicom,Liaoning Branch (Shenyang, China) [8594.93 km]
4713) China Mobile Group Beijing Co.Ltd (Beijing, China) [8615.55 km]
6302) Beijing Fiber City (Beijing, China) [8615.55 km]
5145) Beijing Unicom (Beijing, China) [8615.55 km]
5505) Beijing Broadband Network (Beijing, China) [8615.55 km]
4751) Beijing Telecom (Beijing, China) [8615.55 km]
5509) Chinaunicom Ningxia branch (Ningxia, China) [8729.00 km]
3973) China Telecom (Lanzhou, China) [8747.98 km]
4690) China Unicom Lanzhou Branch Co.Ltd (Lanzhou, China) [8747.98 km]
9484) China Unicom (Changchun, China) [8792.70 km]
5465) China Unicom (Hohhot, China) [8873.46 km]
5992) Qinghai China Unicom (Xining, China) [8903.90 km]
5750) Lhasaunicom (Lhasa, China) [8905.61 km]
4525) Heilongjiang-CMCC (Harbin, China) [8968.03 km]
3784) China Mobile Group Xinjiang Co.,Ltd. (Urumqi, China) [10274.32 km]
6144) xjunicom (Urumqi, China) [10274.32 km]
8554) Xinjiang Wireless Communication Co., Ltd. (Changji, China) [10308.28 km]

结果解释
5081) ShenZhen Telecom (Shenzhen, China) [6953.12 km]

5081: 服务器id
ShenZhen Telecom:isp,这里是深圳电信
Shenzhen, China :服务器所在地址
6953.12 km:两台服务器地理位置之间距离,和深圳相距6953.12公里

 

2、测试我的VPS到深圳这台机器的上传和下载速度,并且生成图片报告

root@vpsyh:~# ./speedtest-cli --server=5081 --share
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from HostUS Solutions LTD (103.27.79.246)...
Hosted by ShenZhen Telecom (Shenzhen) [6953.12 km]: 239.97 ms
Testing download speed........................................
Download: 65.57 Mbit/s
Testing upload speed..................................................
Upload: 4.69 Mbit/s
Share results: http://www.speedtest.net/result/5640642053.png

可以看出,这台VPS到深圳电信的服务器的ping值为239.97ms,下载速度为65.57Mbit/s,上传速度为:4.69Mbit/s
生成的图片结果:

speedtest-cli

 

发表评论