標籤:
1、netperf安裝和使用
netperf安裝
# tar -xzvf netperf-2.7.0.tar.gz# cd netperf-2.7.0# ./configure# make# make install
在用戶端和伺服器上都安裝好。
netperf使用
首先在伺服器端運行netserver.
#./netserver -p 49152 -L 172.18.0.14
Starting netserver with host ‘172.18.0.14‘ port ‘49152‘ and family AF_UNSPEC
在client端利用netperf通過命令列來測試
-H:伺服器的ip地址
-p:連接埠號碼
-L:本地ip地址
-m:發送資料大小
-l:已耗用時間
TCP_STREAM批量傳輸
./netperf -H 172.18.0.14 -p 49152 -L 172.18.0.13 -l 60 -- -m 32768
#./netperf -H 172.16.0.14 -p 49152 -l 60 -- -m 4Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec
87380 65536 4 60.00 27.14
[[email protected] src]# ./netperf -H 172.18.0.14 -p 49152 -L 172.18.0.13 -l 60 -- -m 32768MIGRATED TCP STREAM TEST from 172.18.0.13 () port 0 AF_INET to 172.18.0.14 () port 0 AF_INETRecv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 87380 65536 32768 60.00 7714.07
測試TCP_RR
-r 4,4:請求大小,響應大小
如果只有一個參數-r 4,那麼請求和響應大小就是4.
[[email protected] src]# ./netperf -t TCP_RR -H 172.16.0.14 -p 49152 -L 172.16.0.13 -l 60 -- -r 4MIGRATED TCP REQUEST/RESPONSE TEST from 172.16.0.13 () port 0 AF_INET to 172.16.0.14 () port 0 AF_INET : first burst 0Local /RemoteSocket Size Request Resp. Elapsed Trans.Send Recv Size Size Time Rate bytes Bytes bytes bytes secs. per sec 65536 87380 4 4 60.00 14082.09
2、iperf的安裝和使用
iperf安裝
tar -xzvf iperf-3.0b5.tar.gz[[email protected] tangwh]# cd iperf-3.0b5[[email protected] iperf-3.0b5]# ./configure[[email protected] iperf-3.0b5]# make[[email protected] iperf-3.0b5]# make install
iperf使用
伺服器端:
啟動伺服器
[[email protected] src]# iperf3 -s -p 12345 -i 1
用戶端:
-c:服務端的IP
-p:連接埠號碼
-t:傳輸的總時間
-i:每次報告之間的時間間隔
[[email protected] src]# iperf3 -c 172.16.0.14 -p 12345 -i 1 -t 10Connecting to host 172.16.0.14, port 12345[ 4] local 172.16.0.13 port 46587 connected to 172.16.0.14 port 12345[ ID] Interval Transfer Bandwidth Retransmits[ 4] 0.00-1.01 sec 115 MBytes 956 Mbits/sec 0[ 4] 1.01-2.00 sec 112 MBytes 949 Mbits/sec 0[ 4] 2.00-3.02 sec 115 MBytes 952 Mbits/sec 0[ 4] 3.02-4.01 sec 112 MBytes 949 Mbits/sec 0[ 4] 4.01-5.01 sec 112 MBytes 950 Mbits/sec 0[ 4] 5.01-6.00 sec 112 MBytes 949 Mbits/sec 0[ 4] 6.00-7.02 sec 115 MBytes 949 Mbits/sec 0[ 4] 7.02-8.01 sec 112 MBytes 950 Mbits/sec 0[ 4] 8.01-9.01 sec 112 MBytes 947 Mbits/sec 0[ 4] 9.01-10.00 sec 112 MBytes 949 Mbits/sec 0[ ID] Interval Transfer Bandwidth Retransmits Sent[ 4] 0.00-10.00 sec 1.11 GBytes 950 Mbits/sec 0 Received[ 4] 0.00-10.00 sec 1.11 GBytes 949 Mbits/seciperf Done.
3、Mtr是 Linux中有一個非常棒的網路連通性判斷工具。
-c:發送多少個資料包
-s:發送的ping資料包的大小
-a:設定發送資料包的IP地址
--report:顯示結果在終端上
172.16.0.14指的是要ping的ip地址
[[email protected] tangwh]# mtr -c 10 -s 2 -a 172.16.0.13 --report 172.16.0.14HOST: cn13 Loss% Snt Last Avg Best Wrst StDev 1. mn14 0.0% 10 0.2 0.4 0.2 1.5 0.4
其中host後是本機網域名稱。
第一列指的是IP地址
第二列是每個對應ip的丟包率
第三列是每秒發送資料包的數量,預設為10,用-c來設定
第四列是最近一次的返回時延
第五列是平均時延
第六列是最短時延
第七列是最長時延
第八列是時延抖動
利用netperf、iperf、mtr測試網路