linux环境下,如何使用speedtest测速。其实superbench一键包也是带这个网络带宽测速的,今天单独来说说speedtest测速.
Speedtest测试网络上传/下载速度还是挺不错的,windows下非常方便。Linux下也可以很方便的使用命令行speedtest来测试。speedtest是一个用Python编写的轻量级Linux命令行工具,在Python2.4至3.4版本下均可运行。它基于Speedtest.net的基础架构来测量网络的上/下行速率。安装speedtest很简单,只需要下载其Python脚本文件:
wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
chmod a+rx speedtest.py
mv speedtest.py /usr/local/bin/speedtest
chown root:root /usr/local/bin/speedtest
安装完毕后,在机器上面敲命令speedtest,就会出现下载上传速度。
[root@woyard ~]# speedtest
Retrieving speedtest.net configuration...
Testing from Krypt Technologies (174.139.xxx.xxx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by C3Network.Inc (Diamond Bar, CA) [21.03 km]: 2.994 ms
Testing download speed................................................................................
Download: 465.07 Mbit/s
Testing upload speed................................................................................................
Upload: 489.54 Mbit/s
如上图所示,我拿美国KT洛杉矶云主机测试了下速度,果然是有200M的速度。如果你想分享测试结果,你可以使用参数–share它将会把你的测试结果上传到Speedtest.net服务器并以图形的方式分享给其他人。如果你对目前所有可用的Speedtest.net服务器感兴趣,你可以使用参数–list。它会打印出所有的Speedtest.net服务器(按照离你的地理距离由近及远排序)。
[root@woyard~]# speedtest --list |more
Retrieving speedtest.net configuration...
13654) Sprint (Anaheim, CA, United States) [6.24 km]
7017) C3Network.Inc (Diamond Bar, CA, United States) [21.03 km]
16620) Cox - Orange County (Orange County, CA, United States) [30.12 km]
17775) T-Mobile (El Monte, CA, United States) [32.57 km]
11603) Ultimate Internet Access (Ontario, CA, United States) [33.33 km]
14236) Frontier (Los Angeles, CA, United States) [45.09 km]
5031) AT&T (Los Angeles, CA, United States) [45.09 km]
16974) Spectrum (Los Angeles, CA, United States) [45.09 km]
18857) Bel Air Internet LLC (Los Angeles, CA, United States) [45.09 km]
18229) Starry, Inc. (Los Angeles, CA, United States) [45.09 km]
18401) Windstream (Los Angeles, CA, United States) [45.09 km]
18382) AT&T Wireless (Los Angeles, CA, United States) [45.09 km]
13516) Xfernet (Los Angeles, CA, United States) [45.09 km]
5303) Host Duplex (Los Angeles, CA, United States) [45.09 km]
18393) 2degrees (Los Angeles, CA, United States) [45.09 km]
22736) Inyo Networks Inc (Los Angeles, CA, United States) [45.09 km]
5861) WebNX (Los Angeles, CA, United States) [45.09 km]
22471) Aerioconnect Inc. (Los Angeles, CA, United States) [45.09 km]
5905) GigeNET (Los Angeles, CA, United States) [45.09 km]
17249) Wiline Networks (Los Angeles, CA, United States) [45.09 km]
9916) fdcservers.net (Los Angeles, CA, United States) [45.09 km]
21363) Enzu Inc. (Los Angeles, CA, United States) [45.09 km]
--More--
在上面的列表中,每一行前面都有一个与服务器对应的ID。如果想使用指定的节点来测试你的网速,你只需要在speedtest命令后指定其ID即可。例如,如果想使用上图中的5031服务器,你只需要指定相对应的服务器ID5031即可。
speedtest --server 5031
Retrieving speedtest.net configuration…
Testing from Krypt Technologies (174.139.xxx.161)…
Retrieving speedtest.net server list…
Retrieving information for the selected server…
Hosted by AT&T (Los Angeles, CA) [45.09 km]: 7.631 ms
Testing download speed……………………………………………………………………..
Download: 435.32 Mbit/s
Testing upload speed……………………………………………………………………………………
Upload: 459.45 Mbit/s
[root@woyard ~]# speedtest --share
Retrieving speedtest.net configuration...
Testing from Krypt Technologies (174.139.202.161)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by C3Network.Inc (Diamond Bar, CA) [21.03 km]: 6.014 ms
Testing download speed................................................................................
Download: 467.90 Mbit/s
Testing upload speed................................................................................................
Upload: 488.26 Mbit/s
Share results: http://www.speedtest.net/result/87638071859.png