小巧好用的網(wǎng)絡(luò)性能測試工具iPerf

作為一個網(wǎng)絡(luò)工程師經(jīng)常會遇到這種情況,需要在兩點間測試實際可跑帶寬。
帶寬小的線路可以搭個FTP服務(wù)器,或者直接用scp拷文件這種方式,如果線路超過10G以上就不好用了,一方面需要準備大文件,另一方面磁盤的讀寫性能也影響到測試結(jié)果的準確性,這時這個小巧的開源軟件就派上用場了。

iPerf是用于主動測量IP網(wǎng)絡(luò)上最大可承載帶寬的工具。它支持調(diào)整與時序,緩沖區(qū)和協(xié)議(TCP,UDP,SCTP與IPv4和IPv6)有關(guān)的各種參數(shù)。對于每個測試,它都會報告帶寬,丟失和其他參數(shù)。官方地址https://iperf.fr/

iPerf功能

  • TCP和SCTP
    • 測量帶寬
    • 報告MSS / MTU大小和觀察的讀取大小。
    • 通過套接字緩沖區(qū)支持TCP窗口大小。
  • UDP
    • 客戶端可以創(chuàng)建指定帶寬的UDP流。
    • 測量數(shù)據(jù)包丟失
    • 測量延遲抖動
    • 多播能力

跨平臺:Windows,Linux,Android,MacOS X,F(xiàn)reeBSD,OpenBSD,NetBSD,VxWorks,Solaris ...基本所有的系統(tǒng)都支持了。軟件下載地址https://iperf.fr/iperf-download.php,當前最新版本為iperf3

安裝

CentOS 可以直接用 yum install iperf或yum install iperf3安裝

使用(我使用的是iperf3)

  • TCP模式

服務(wù)器端:

[root@10-57-22-228 ~]# iperf3 -s -p 1234 -i 1
-----------------------------------------------------------
Server listening on 1234

客戶端:

[root@10-57-22-128 ~]# iperf3 -c 10.57.22.228 -p 1234 -i 1 -t 10
Connecting to host 10.57.22.228, port 1234
[  4] local 10.57.22.128 port 38079 connected to 10.57.22.228 port 1234
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   112 MBytes   941 Mbits/sec  250    270 KBytes       
[  4]   1.00-2.00   sec   111 MBytes   932 Mbits/sec  305    369 KBytes       
[  4]   2.00-3.00   sec   111 MBytes   933 Mbits/sec  978    259 KBytes       
[  4]   3.00-4.00   sec   111 MBytes   930 Mbits/sec  358    349 KBytes       
[  4]   4.00-5.00   sec   111 MBytes   931 Mbits/sec  654    286 KBytes       
[  4]   5.00-6.00   sec   111 MBytes   933 Mbits/sec  360    354 KBytes       
[  4]   6.00-7.00   sec   111 MBytes   934 Mbits/sec  417    366 KBytes       
[  4]   7.00-8.00   sec   111 MBytes   934 Mbits/sec  696    329 KBytes       
[  4]   8.00-9.00   sec   111 MBytes   931 Mbits/sec  660    209 KBytes       
[  4]   9.00-10.00  sec   110 MBytes   926 Mbits/sec  912    202 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  1.09 GBytes   932 Mbits/sec  5590             sender
[  4]   0.00-10.00  sec  1.08 GBytes   931 Mbits/sec                  receiver

在tcp模式下,客戶端到服務(wù)器10.57.22.228上傳帶寬測試,測試時間為10秒。

[root@10-57-22-128 ~]# iperf3 -c 10.57.22.228 -p 1234  -d -t 10     
send_parameters:
{
        "tcp":  true,
        "omit": 0,
        "time": 10,
        "parallel":     1,
        "len":  131072,
        "client_version":       "3.1.7"
}
Connecting to host 10.57.22.228, port 1234
SNDBUF is 16384, expecting 0
RCVBUF is 87380, expecting 0
Congestion algorithm is cubic
[  4] local 10.57.22.128 port 38112 connected to 10.57.22.228 port 1234
tcpi_snd_cwnd 225 tcpi_snd_mss 1448 tcpi_rtt 2379
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   112 MBytes   940 Mbits/sec  317    318 KBytes       
tcpi_snd_cwnd 187 tcpi_snd_mss 1448 tcpi_rtt 2001
[  4]   1.00-2.00   sec   110 MBytes   923 Mbits/sec  1763    264 KBytes       
tcpi_snd_cwnd 255 tcpi_snd_mss 1448 tcpi_rtt 1908
[  4]   2.00-3.00   sec   109 MBytes   914 Mbits/sec  1741    361 KBytes       
tcpi_snd_cwnd 261 tcpi_snd_mss 1448 tcpi_rtt 2795
[  4]   3.00-4.00   sec   109 MBytes   916 Mbits/sec  1729    369 KBytes       
tcpi_snd_cwnd 198 tcpi_snd_mss 1448 tcpi_rtt 2081
[  4]   4.00-5.00   sec   109 MBytes   917 Mbits/sec  2040    280 KBytes       
tcpi_snd_cwnd 255 tcpi_snd_mss 1448 tcpi_rtt 5058
[  4]   5.00-6.00   sec   106 MBytes   889 Mbits/sec  4096    361 KBytes       
tcpi_snd_cwnd 190 tcpi_snd_mss 1448 tcpi_rtt 2277
[  4]   6.00-7.00   sec   109 MBytes   916 Mbits/sec  2050    269 KBytes       
tcpi_snd_cwnd 255 tcpi_snd_mss 1448 tcpi_rtt 2336
[  4]   7.00-8.00   sec   110 MBytes   919 Mbits/sec  1702    361 KBytes       
tcpi_snd_cwnd 262 tcpi_snd_mss 1448 tcpi_rtt 3349
[  4]   8.00-9.00   sec   108 MBytes   910 Mbits/sec  2175    370 KBytes       
tcpi_snd_cwnd 199 tcpi_snd_mss 1448 tcpi_rtt 3639
send_results
{
        "cpu_util_total":       4.364935,
        "cpu_util_user":        0.135769,
        "cpu_util_system":      4.285394,
        "sender_has_retransmits":       1,
        "congestion_used":      "cubic",
        "streams":      [{
                        "id":   1,
                        "bytes":        1138941776,
                        "retransmits":  23838,
                        "jitter":       0,
                        "errors":       0,
                        "packets":      0
                }]
}
get_results
{
        "cpu_util_total":       5.207115,
        "cpu_util_user":        0.278441,
        "cpu_util_system":      4.931552,
        "sender_has_retransmits":       -1,
        "congestion_used":      "cubic",
        "streams":      [{
                        "id":   1,
                        "bytes":        1137687808,
                        "retransmits":  -1,
                        "jitter":       0,
                        "errors":       0,
                        "packets":      0
                }]
}
[  4]   9.00-10.00  sec   103 MBytes   867 Mbits/sec  6225    281 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  1.06 GBytes   911 Mbits/sec  23838             sender
[  4]   0.00-10.00  sec  1.06 GBytes   910 Mbits/sec                  receiver

iperf Done.

進行上下行帶寬測試。

更多功能使用Iperf3 --help查看說明

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 24.1 引言 TCP已經(jīng)在從1200 b/s的撥號SLIP鏈路到以太數(shù)據(jù)鏈路上運行了許多年。在80年代和90年代...
    張芳濤閱讀 1,638評論 0 3
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,569評論 19 139
  • 本書結(jié)構(gòu)是自頂向下的,所以請按下列順序閱讀: 1.計算機網(wǎng)絡(luò)自頂向下--應(yīng)用層2.計算機網(wǎng)絡(luò)自頂向下--運輸層3....
    牛富貴兒閱讀 3,213評論 0 3
  • Socket編程 1基礎(chǔ)知識 協(xié)議 端口號(辨別不同應(yīng)用) TCP/IP協(xié)議 是目前世界上應(yīng)用最廣泛的協(xié)議是以TC...
    __豆約翰__閱讀 1,191評論 0 3
  • 一世風(fēng)燭,為誰白首。 偶然,想到這八個字。像至尊寶,像唐僧。 至尊寶最終選擇了放下,放下也是拿起,這種拿起,卻是遺...
    水月_聽風(fēng)閱讀 227評論 0 1

友情鏈接更多精彩內(nèi)容