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 //查不到登陸失敗信息

清除歷史記錄:history -c


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM