Linux系统下的网络带宽测速
网络测速
speedtest
下载通过直接下载SpeedTest脚本,给权限运行脚本即可
[root@localhost ~]# curl -o speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
[root@localhost ~]# chmod +x speedtest-cli
[root@localhost ~]# ./speedtest-cli --share
Retrieving speedtest.net configuration...
Testing from Itace International Limited (103.41.124.83)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by i3D.net (Hong Kong) [0.00 km]: 8.013 ms
Testing download speed................................................................................
Download: 4.37 Mbit/s
Testing upload speed................................................................................................
Upload: 10.73 Mbit/s
Share results: http://www.speedtest.net/result/9551161855.png
[root@localhost ~]#
查看所有国内测试节点,并指定测试节点进行测试
[root@localhost ~]# ./speedtest-cli --list | grep China
1536) STC (Hong Kong, China) [0.00 km]
2993) Website Solution Limited (Hong Kong, China) [0.00 km]
32155) China Mobile Hong Kong (Hong Kong, Hong Kong) [0.00 km]
19036) SmarTone (Hong Kong, China) [0.00 km]
16192) ShenZhen Unicom (ShenZhen, China) [31.69 km]
4515) China Mobile,Guangdong (Shenzhen, China) [31.69 km]
32468) GMCC (ZHUHAI, China) [60.76 km]
26678) Guangzhou Unicom 5G (Guangzhou, China) [134.80 km]
6611) China Mobile,Guangdong (Guangzhou, China) [134.80 km]
27594) ChinaTelecom 5G (Guangzhou, China) [134.80 km]
15863) GX ChinaMobile (Nanning, China) [604.08 km]
5674) GX-Unicom (Nanning, China) [604.08 km]
27810) GX-Telecom (Nanning, China) [604.08 km]
26677) Changsha, Hunan Unicom (Zhuzhou, China) [628.90 km]
28491) China Mobile HuNan 5G (ChangSha, China) [669.76 km]
4870) Changsha, Hunan Unicom,Server1 (Changsha, China) [671.99 km]
28225) Hunan Telecom 5G (Changsha, China) [671.99 km]
......
[root@localhost ~]# ./speedtest-cli --server=6611 --share
Retrieving speedtest.net configuration...
Testing from Itace International Limited (103.41.124.83)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by China Mobile,Guangdong (Guangzhou) [134.80 km]: 688.751 ms
Testing download speed................................................................................
Download: 4.02 Mbit/s
Testing upload speed................................................................................................
Upload: 5.32 Mbit/s
Share results: http://www.speedtest.net/result/9551180382.png
[root@localhost ~]#
iperf
服务端与客户端 都要安装iperf工具
yum install -y iperf
[root@localhost ~]# wget -O /usr/lib/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0_3.1.3
[root@localhost ~]# wget -O /usr/bin/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3
[root@localhost ~]# chmod +x /usr/bin/iperf3
注:在CentOS 7下安装iperf3时可能会出现如下错误
iperf3: error while loading shared libraries: libiperf.so.0: cannot open shared object file: No such file or directory
一般情况下是因为wget了iperf3的动态链接库,而共享库未能及时更新,需要手动执行 ldconfig 命令以创建连接和缓存文件。
[root@localhost ~]# ldconfig
查看版本
[root@localhost ~]# iperf3 -v
iperf 3.1.3
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64
Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing
服务端启动服务,作为server:
iperf3 -s
客户端启动服务,作为client:
iperf3 -c <server_IP> -d -t 60
搭建网站–>网站根目录dd if 建立大文件index.html–>远程download测速wget/curl
清除用户登录成功记录:
[root@localhost root]# echo > /var/log/wtmp //此文件默认打开时乱码,可查到ip等信息
[root@localhost root]# last //此时即查不到用户登录信息
清除登陆系统失败的记录
[root@localhost root]# echo > /var/log/btmp //此文件默认打开时乱码,可查到登陆失败信息
[root@localhost root]# lastb //查不到登陆失败信息