chariot iperf使用_Linux command – iperf

本文详细介绍了如何在Linux系统中使用iperf进行网络带宽测试,包括iperf的下载、安装、参数设置及使用方法。通过Server和Client两端的操作,展示了如何进行TCP/UDP带宽性能的测量,同时提到了iperf的GUI版本jperf的使用。
摘要由CSDN通过智能技术生成

Step 1.下載程式

Step 2.安裝 iperf (Server端)

Step 3.安裝 iperf (client端)

Step 4.看 iperf 結果

Step 5.iperf 參數

Step 6.jperf 圖形(GUI) 介面的 iperf

Step 1.下載程式

通常我們在 Linux 下面可以透過 Iometer 去測試硬碟的效能速度,那網路呢!!要以免費最簡單使用的就算是 iperf了.

Iperf 是由 NLANR( National Laboratory for Applied Network Research)所開發出來的工具,主要 iperf 可以用來量測網路的最大的 TCP / UDP  網路頻寬/效能,但僅僅如此如果你需要更精準的網路效能或是穩定度那建議使用另外一套專業級的網路效能測試工具 IxChariot – http://benjr.tw/470.不過我們先來看看 iperf 如何使用, iperf 並不是 Linux 系統預設套件,可以從 sourceforge 中下載. http://sourceforge.net/projects/iperf 它支援的作業系統包括了  linux, unix 和 window,採用 Server / Client 模式進行量測.

測試環境如下:

基本上只要兩台 Linux 機台就可以做網路效能測試,當然兩張網卡速度要一致,並同時將這個程式安裝在 Server 和 Client 上面.

Step 2.安裝 iperf(Server端 IP:192.12.1.2)

如果是用 Ubuntu 就可以直接透過 #apt-get install iperf 來安裝,透過 apt-get 安裝的版本為 2.x ,但已經有 iperf 3.x – https://iperf.fr/iperf-download.php 的版本可以使用.

[root@Server ~]# tar iperf

[root@Server ~]# cd iperf

依據你的系統配置出所需的環境變數

[root@Server iperf]# ./configure

編譯 Iperf

[root@Server iperf]# make

安裝 Iperf,非必要性剛剛在編譯實已經產生執行檔案在 iperf/src 下,安裝是將 iperf 放置至 /usr/local/bin/iperf

[root@Server iperf]# make install

[root@Server iperf]# iperf -s

Server 端的程式要先開,去監看 Client 端的封包!預設使用 TCP port 5001.TCP read/write buffer 預設是 8KB

Step 3.安裝 iperf(client端 IP:192.12.1.1)

[root@benjr ~]# tar iperf

[root@benjr ~]# cd iperf

依據你的系統配置出所需的環境變數

[root@benjr iperf]# ./configure

編譯 Iperf

[root@benjr iperf]# make

安裝 Iperf,非必要性剛剛在編譯實已經產生執行檔案在 iperf/src 下,安裝是將 iperf 放置至 /usr/local/bin/iperf

[root@benjr iperf]# make install

[root@benjr iperf]# iperf -c 192.12.1.2 -t 10 -i 5

#-c : server IP

#-t : 測量時間間隔為10秒

#-i : 每隔 5 秒將測量結果顯示出來,最後再算出平均值.

Step 4.看 iperf 結果

Server 端 IP:192.12.1.2

[root@Server ~]# iperf -s

————————————————————

Server listening on TCP port 5001

TCP window size: 85.3 KByte (default)

————————————————————

client 端 IP:192.12.1.1

[root@benjr ~]# iperf -c 192.12.1.2 -t 10 -i 5

————————————————————

Client connecting to 192.12.1.2, TCP port 5001

TCP window size: 16.0 KByte (default)

————————————————————

[ 3] local 192.168.10.10 port 46647 connected with 192.12.1.2 port 5001

[ ID] Interval Transfer Bandwidth

[ 3] 0.0- 5.0 sec 1.43 GBytes 2.46 Gbits/sec

[ 3] 5.0-10.0 sec 1.46 GBytes 2.52 Gbits/sec

[ 3] 0.0-10.0 sec 2.89 GBytes 2.49 Gbits/sec

顯示結果依序為1.執行時間  2.時間內所傳輸的總資料量. 3.頻寬為 #Mbits/sec

Step 5.iperf 參數

-w n[KM]  指定 TCP window size (2~256KB)

-l n[KM] 指定 read/write buffer 大小(預設為 8k)

-Pn (大寫的P) client 端指定同時 (parallel) 跑幾個的 threads

[root@Server ~]# iperf -s -w 256k -l 64k

bind failed: Address already in use

Server listening on TCP port 5001

TCP window size: 256 KByte

Server 和 Client 需要用相同的參數才可以跑!

因為用了  -P4 參數,所以系統一次會建立 4 個連線,所以你在結果會看到 [4] [5] [6] [7] 個別連線跑出來的結果,以及 [SUM] 4 個連線加總得到的結果.

[root@benjr ~]# iperf -c 192.12.1.2 -t 10 -w 256k -i 5 -l 64k -P4

————————————————————

Client connecting to 192.12.1.2, TCP port 5001

TCP window size: 256 KByte

————————————————————

[ 5] local 192.168.10.10 port 58809 connected with 192.12.1.2 port 5001

[ 3] local 192.168.10.10 port 58808 connected with 192.12.1.2 port 5001

[ 4] local 192.168.10.10 port 58807 connected with 192.12.1.2 port 5001

[ 6] local 192.168.10.10 port 58810 connected with 192.12.1.2 port 5001

[ ID] Interval Transfer Bandwidth

[ 5] 0.0- 5.0 sec 1.17 GBytes 2.02 Gbits/sec

[ 3] 0.0- 5.0 sec 945 MBytes 1.59 Gbits/sec

[ 4] 0.0- 5.0 sec 1.00 GBytes 1.72 Gbits/sec

[ 6] 0.0- 5.0 sec 982 MBytes 1.65 Gbits/sec

[SUM] 0.0- 5.0 sec 4.06 GBytes 6.97 Gbits/sec

[ 5] 5.0-10.0 sec 1.24 GBytes 2.12 Gbits/sec

[ 5] 0.0-10.0 sec 2.41 GBytes 2.07 Gbits/sec

[ 3] 5.0-10.0 sec 1004 MBytes 1.69 Gbits/sec

[ 3] 0.0-10.0 sec 1.90 GBytes 1.64 Gbits/sec

[ 6] 5.0-10.0 sec 1.00 GBytes 1.72 Gbits/sec

[ 6] 0.0-10.0 sec 1.96 GBytes 1.68 Gbits/sec

[ 4] 5.0-10.0 sec 1015 MBytes 1.70 Gbits/sec

[SUM] 5.0-10.0 sec 4.21 GBytes 7.24 Gbits/sec

[ 4] 0.0-10.0 sec 1.99 GBytes 1.71 Gbits/sec

[SUM] 0.0-10.0 sec 8.27 GBytes 7.10 Gbits/sec

Step 6.jperf 圖形(GUI) 介面的 iperf

xjperf 是有圖形 GUI 介面的 iperf,不過他是架構在 iperf 必須先安裝過 iperf 才可以使用.下載點在 http://code.google.com/p/xjperf/downloads/list 方式也很簡單,先行安裝完 iperf  再解開 xjperf 即可執行

[root@benjr ~]# unzip jperf2.0.0.zip

Archive: jperf2.0.0.zip

creating: bin/

creating: lib/

inflating: bin/iperf.exe

inflating: jperf.bat

inflating: jperf.sh

inflating: jperf2.0.0.jar

inflating: lib/forms-1.1.0.jar

inflating: lib/jcommon-1.0.10.jar

inflating: lib/jfreechart-1.0.6.jar

inflating: lib/swingx-2008_02_03.jar

[root@benjr ~]# sh jperf.sh

相對應的指令參數會顯示在最上面,就如圖我們在使用 iperf 時一樣.不過我在 RHEL5 Update 2 上面使用時這一隻程式倒是常常當掉.

iperf 其他說明與應用

MTU (Maximum Transmission Unit ) – http://benjr.tw/3025

統計 jitter 以及 packet loss – http://benjr.tw/3030

Multiple client requests (多對一) – http://benjr.tw/94180

Bidirectional test (雙向測試) – http://benjr.tw/94171

沒有解決問題,試試搜尋本站其他內容

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值