一、Speedtest測試外網(wǎng)網(wǎng)速
Speedtest是用來測試網(wǎng)絡(luò)性能的開源軟件,在Linux下面安裝Speedtest可以用來測試網(wǎng)絡(luò)出口的上傳和下載速度,幫助排查網(wǎng)絡(luò)方面導(dǎo)致的故障。
官網(wǎng):
Github鏈接:https://github.com/sivel/speedtest-cli
Speendtest.net官網(wǎng):http://www.speedtest.net/
windows直接點(diǎn)擊網(wǎng)頁測試即可。
1. 安裝
1.1 pip安裝
speedtest是用python寫的,沒使用過pip的需要先安裝pip,
pip安裝:https://pip.pypa.io/en/stable/installing/
#開啟epel源
yum install python-pip –y
安裝speedtest-cli
pip install speedtest-cli
安裝完成測試
which speedtest-cli | bash
1.2 github安裝
pip install git+https://github.com/sivel/speedtest-cli.git
或者
git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install
1.3 shell安裝
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli
./speedtest-cli
2. speedtest-cli使用
speedtest-cli -h
speedtest-cli --share? 生成一張分享圖片
speedtest-cli --list
二、iperf/iperf3測試服務(wù)器間網(wǎng)速(支持windows和linux)
iperf命令是一個網(wǎng)絡(luò)性能測試工具。iperf可以測試TCP和UDP帶寬質(zhì)量。iperf可以測量最大TCP帶寬,具有多種參數(shù)和UDP特性。iperf可以報告帶寬,延遲抖動和數(shù)據(jù)包丟失。利用iperf這一特性,可以用來測試一些網(wǎng)絡(luò)設(shè)備如路由器,防火墻,交換機(jī)等的性能。
Linux:
1.安裝
1.1? 用yum軟件倉庫安裝
? yum -y install? epel-release
? iperf安裝:yum install iperf -y
? iperf3 安裝: yum install iperf3 -y
1.2 下載程序包手工安裝方式
下載地址:
https://iperf.fr/download/fedora/iperf3-3.1.3-1.fc24.i686.rpm
rpm -ivh iperf3-3.1.3-1.fc24.i686.rpm(需要處理依賴)
2.使用
參數(shù)說明:
-s 以server模式啟動。#iperf -s
-c host以client模式啟動。host是server端地址。#iperf -c serverip
通用參數(shù):
-f [kmKM] 分別表示以Kbits, Mbits, KBytes, MBytes顯示報告,默認(rèn)以Mbits為單位,#iperf -c 192.168.100.6 -f K
-i sec 以秒為單位顯示報告間隔,#iperf -c 192.168.100.6 -i 2
-l 緩沖區(qū)大小,默認(rèn)是8KB,#iperf -c 192.168.100.6 -l 64
-m 顯示tcp最大mtu值
-o 將報告和錯誤信息輸出到文件#iperf -c 192.168.100.6 -o ciperflog.txt
-p 指定服務(wù)器端使用的端口或客戶端所連接的端口#iperf -s -p 5001;iperf -c 192.168.100.55 -p 5001
-u 使用udp協(xié)議
-w 指定TCP窗口大小,默認(rèn)是8KB
-B 綁定一個主機(jī)地址或接口(當(dāng)主機(jī)有多個地址或接口時使用該參數(shù))
-C 兼容舊版本(當(dāng)server端和client端版本不一樣時使用)
-M 設(shè)定TCP數(shù)據(jù)包的最大mtu值
-N 設(shè)定TCP不延時
-V 傳輸ipv6數(shù)據(jù)包
server專用參數(shù):
-D 以服務(wù)方式運(yùn)行。#iperf -s -D
-R 停止iperf服務(wù)。針對-D,#iperf -s -R
client端專用參數(shù):
-d 同時進(jìn)行雙向傳輸測試
-n 指定傳輸?shù)淖止?jié)數(shù),#iperf -c 192.168.100.6 -n 1024000
-r 單獨(dú)進(jìn)行雙向傳輸測試
-t 測試時間,默認(rèn)20秒,#iperf -c 192.168.100.6 -t 5
-F 指定需要傳輸?shù)奈募?/p>
-T 指定ttl值
UDP模式
服務(wù)器端:
iperf3 -u -s
客戶端:
iperf3 -u -c 172.168.1.1 -b 100M -t 60
在udp模式下,以100Mbps為數(shù)據(jù)發(fā)送速率,客戶端上傳帶寬測試,測試時間為60秒。
iperf3 -u -c 172.168.1.1 -b 5M -P 30 -t 60
客戶端發(fā)起30個連接線程,以5Mbps為數(shù)據(jù)發(fā)送速率。
iperf3 -u -c 172.168.1.1 -b 100M -d -t 60
以100M為數(shù)據(jù)發(fā)送速率,進(jìn)行上下行帶寬測試。
TCP模式
服務(wù)器端:
iperf3? -s? -p 5002 -d?
客戶端:
iperf3 -c 172.168.1.1 -t 60? -p 5002
在tcp模式下,客戶端上傳帶寬測試,測試時間為60秒。
iperf3 -c 172.168.1.1? -P 30 -t 60? -p 5002
客戶端發(fā)起30個連接線程。
iperf3 -c 172.168.1.1? -d -t 60? -p 5002
進(jìn)行上下行帶寬測試。
WINDOWS:
下載地址:https://iperf.fr/iperf-download.php
直接將解壓出來的iperf3.exe和cygwin1.dll復(fù)制到%systemroot%目錄即可,然后就可以在cmd中使用。
%SystemRoot% 系統(tǒng)目錄,環(huán)境變量,可以直接在目錄欄輸入。
命令參數(shù):
測試:
客戶端:
iperf3 -c 10.211.55.6 -t 10? -p 5002? (直接連接linux的iperf3 server)