Linux网络性能评估工具iperf
来源:互联网 发布:批处理软件 编辑:程序博客网 时间:2024/06/06 00:21
测试网络带宽
支持多线程,在客户端与服务端支持多重连接
报告MSS/MTU值大小
支持TCP窗口值自定义并可通过套接字缓冲
可以设置指定带宽的UDP数据流
可以测试网络抖动值、丢包数
支持多播测试
支持多线程,在客户端与服务器端支持多重连接
1
2
3
4
[root@web1 ~]
# tar zxf iperf-3.1.2-source.tar.gz
[root@web1 ~]
# cd iperf-3.1.2
[root@web1 iperf-3.1.2]
# ./configure
[root@web1 iperf-3.1.2]
# make && make install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
[root@web1 ~]
# iperf3 -h
Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-
v
|--version]
Server or Client:
-p, --port
# server port to listen on/connect to
-f, --
format
[kmgKMG]
format
to report: Kbits, Mbits, KBytes, MBytes
-i, --interval
# seconds between periodic bandwidth reports
-F, --
file
name xmit
/recv
the specified
file
-A, --affinity n
/n
,m
set
CPU affinity
-B, --bind <host> bind to a specific interface
-V, --verbose
more
detailed output
-J, --json output
in
JSON
format
--logfile f send output to a log
file
-d, --debug emit debugging output
-
v
, --version show version information and quit
-h, --help show this message and quit
Server specific:
-s, --server run
in
server mode
-D, --daemon run the server as a daemon
-I, --pidfile
file
write PID
file
-1, --one-off handle one client connection
then
exit
Client specific:
-c, --client <host> run
in
client mode, connecting to <host>
-u, --udp use UDP rather than TCP
-b, --bandwidth
#[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
(default 1 Mbit
/sec
for
UDP, unlimited
for
TCP)
(optional slash and packet count
for
burst mode)
-t, --
time
# time in seconds to transmit for (default 10 secs)
-n, --bytes
#[KMG] number of bytes to transmit (instead of -t)
-k, --blockcount
#[KMG] number of blocks (packets) to transmit (instead of -t or -n)
-l, --len
#[KMG] length of buffer to read or write
(default 128 KB
for
TCP, 8 KB
for
UDP)
--cport <port> bind to a specific client port (TCP and UDP, default: ephemeral port)
-P, --parallel
# number of parallel client streams to run
-R, --reverse run
in
reverse mode (server sends, client receives)
-w, --window
#[KMG] set window size / socket buffer size
-C, --congestion <algo>
set
TCP congestion control algorithm (Linux and FreeBSD only)
-M, --
set
-mss
# set TCP/SCTP maximum segment size (MTU - 40 bytes)
-N, --no-delay
set
TCP
/SCTP
no delay, disabling Nagle's Algorithm
-4, --version4 only use IPv4
-6, --version6 only use IPv6
-S, --tos N
set
the IP
'type of service'
-L, --flowlabel N
set
the IPv6 flow label (only supported on Linux)
-Z, --zerocopy use a
'zero copy'
method of sending data
-O, --omit N omit the first n seconds
-T, --title str prefix every output line with this string
--get-server-output get results from server
--udp-counters-64bit use 64-bit counters
in
UDP
test
packets
[KMG] indicates options that support a K
/M/G
suffix
for
kilo-, mega-, or giga-
iperf3 homepage at: http:
//software
.es.net
/iperf/
Report bugs to: https:
//github
.com
/esnet/iperf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
##指定20秒内每隔5秒输出一次结果
[root@web2 ~]
# iperf3 -c 192.168.1.250 -t 20 -i 5
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 55780 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 1.79 GBytes 3.07 Gbits
/sec
0 1.07 MBytes
[ 4] 5.00-10.00 sec 1.85 GBytes 3.18 Gbits
/sec
0 1.16 MBytes
[ 4] 10.00-15.00 sec 1.83 GBytes 3.14 Gbits
/sec
0 1.20 MBytes
[ 4] 15.00-20.00 sec 1.78 GBytes 3.06 Gbits
/sec
0 1.24 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-20.00 sec 7.25 GBytes 3.11 Gbits
/sec
0 sender
[ 4] 0.00-20.00 sec 7.24 GBytes 3.11 Gbits
/sec
receiver
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#指定发送一个5GB左右的数据包,并且每隔2秒输出状态结果
[root@web2 ~]
# iperf3 -c 192.168.1.250 -i 2 -n 5000000000
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 56432 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-2.00 sec 758 MBytes 3.18 Gbits
/sec
0 952 KBytes
[ 4] 2.00-4.00 sec 769 MBytes 3.23 Gbits
/sec
0 984 KBytes
[ 4] 4.00-6.00 sec 757 MBytes 3.17 Gbits
/sec
0 1.01 MBytes
[ 4] 6.00-8.00 sec 684 MBytes 2.87 Gbits
/sec
0 1.05 MBytes
[ 4] 8.00-10.00 sec 734 MBytes 3.08 Gbits
/sec
0 1.08 MBytes
[ 4] 10.00-12.00 sec 754 MBytes 3.16 Gbits
/sec
0 1.11 MBytes
[ 4] 12.00-12.88 sec 313 MBytes 2.99 Gbits
/sec
0 1.12 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-12.88 sec 4.66 GBytes 3.11 Gbits
/sec
0 sender
[ 4] 0.00-12.88 sec 4.65 GBytes 3.10 Gbits
/sec
receiver
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
##指定一个文件传输(-F)
[root@web2 ~]
# du -sh ntopng-2.2.tar.gz
88M ntopng-2.2.
tar
.gz
[root@web2 ~]
# iperf3 -c 192.168.1.250 -F ntopng-2.2.tar.gz -t 20-i 2
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 56948 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-0.12 sec 36.7 MBytes 2.47 Gbits
/sec
0 420 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-0.12 sec 36.7 MBytes 2.47 Gbits
/sec
0 sender
Sent 36.7 MByte / 87.1 MByte (42%) of ntopng-2.2.
tar
.gz
[ 4] 0.00-0.12 sec 34.9 MBytes 2.36 Gbits
/sec
receiver
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#使用单线程传输,传输10GB的数据一共消耗了27.36秒,平均速率为350 MBytes/sec
[root@web2 ~]
# iperf3 -c 192.168.1.250 -n 10000000000 -i 5 -f M
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 57348 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 1.58 GBytes 324 MBytes
/sec
0 1.11 MBytes
[ 4] 5.00-10.00 sec 1.62 GBytes 333 MBytes
/sec
0 1.21 MBytes
[ 4] 10.00-15.00 sec 1.65 GBytes 339 MBytes
/sec
0 1.27 MBytes
[ 4] 15.00-20.00 sec 1.76 GBytes 361 MBytes
/sec
0 1.31 MBytes
[ 4] 20.00-25.00 sec 1.82 GBytes 373 MBytes
/sec
37 1.32 MBytes
[ 4] 25.00-27.36 sec 886 MBytes 376 MBytes
/sec
0 1.35 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-27.36 sec 9.31 GBytes 349 MBytes
/sec
37 sender
[ 4] 0.00-27.36 sec 9.31 GBytes 348 MBytes
/sec
receiver
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@web2 ~]
# iperf3 -c 192.168.1.250 -n 10000000000 -i 5
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 57585 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 1.87 GBytes 3.21 Gbits
/sec
0 990 KBytes
[ 4] 5.00-10.00 sec 1.87 GBytes 3.22 Gbits
/sec
0 1.04 MBytes
[ 4] 10.00-15.00 sec 1.81 GBytes 3.12 Gbits
/sec
0 1.12 MBytes
[ 4] 15.00-20.00 sec 1.75 GBytes 3.01 Gbits
/sec
0 1.20 MBytes
[ 4] 20.00-25.00 sec 1.76 GBytes 3.03 Gbits
/sec
14 1.37 MBytes
[ 4] 25.00-25.81 sec 245 MBytes 2.53 Gbits
/sec
0 1.38 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-25.81 sec 9.31 GBytes 3.10 Gbits
/sec
14 sender
[ 4] 0.00-25.81 sec 9.31 GBytes 3.10 Gbits
/sec
receiver
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[root@web2 ~]
# iperf3 -c 192.168.1.250 -n 10000000000 -i 5 -P 2 -f M
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 57751 connected to 192.168.1.250 port 5201
[ 6]
local
192.168.1.209 port 57752 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 905 MBytes 181 MBytes
/sec
0 585 KBytes
[ 6] 0.00-5.00 sec 903 MBytes 181 MBytes
/sec
0 602 KBytes
[SUM] 0.00-5.00 sec 1.77 GBytes 362 MBytes
/sec
0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 5.00-10.00 sec 917 MBytes 183 MBytes
/sec
0 687 KBytes
[ 6] 5.00-10.00 sec 917 MBytes 183 MBytes
/sec
0 704 KBytes
[SUM] 5.00-10.00 sec 1.79 GBytes 367 MBytes
/sec
0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 10.00-15.00 sec 929 MBytes 186 MBytes
/sec
0 723 KBytes
[ 6] 10.00-15.00 sec 929 MBytes 186 MBytes
/sec
0 735 KBytes
[SUM] 10.00-15.00 sec 1.81 GBytes 372 MBytes
/sec
0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 15.00-20.00 sec 921 MBytes 184 MBytes
/sec
0 745 KBytes
[ 6] 15.00-20.00 sec 920 MBytes 184 MBytes
/sec
0 759 KBytes
[SUM] 15.00-20.00 sec 1.80 GBytes 368 MBytes
/sec
0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 20.00-25.00 sec 919 MBytes 184 MBytes
/sec
0 782 KBytes
[ 6] 20.00-25.00 sec 919 MBytes 184 MBytes
/sec
0 802 KBytes
[SUM] 20.00-25.00 sec 1.79 GBytes 368 MBytes
/sec
0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 25.00-25.97 sec 179 MBytes 184 MBytes
/sec
0 785 KBytes
[ 6] 25.00-25.97 sec 180 MBytes 185 MBytes
/sec
0 803 KBytes
[SUM] 25.00-25.97 sec 359 MBytes 369 MBytes
/sec
0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-25.97 sec 4.66 GBytes 184 MBytes
/sec
0 sender
[ 4] 0.00-25.97 sec 4.65 GBytes 183 MBytes
/sec
receiver
[ 6] 0.00-25.97 sec 4.66 GBytes 184 MBytes
/sec
0 sender
[ 6] 0.00-25.97 sec 4.65 GBytes 183 MBytes
/sec
receiver
[SUM] 0.00-25.97 sec 9.31 GBytes 367 MBytes
/sec
0 sender
[SUM] 0.00-25.97 sec 9.30 GBytes 367 MBytes
/sec
receiver
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@web2 ~]
# iperf3 -c 192.168.1.250 -u -b 1G -f M -i 2
Connecting to host 192.168.1.250, port 5201
[ 4]
local
192.168.1.209 port 45424 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Total Datagrams
[ 4] 0.00-2.00 sec 81.1 MBytes 40.5 MBytes
/sec
10377
[ 4] 2.00-4.00 sec 94.5 MBytes 47.3 MBytes
/sec
12102
[ 4] 4.00-6.00 sec 94.6 MBytes 47.3 MBytes
/sec
12107
[ 4] 6.00-8.00 sec 103 MBytes 51.5 MBytes
/sec
13192
[ 4] 8.00-10.00 sec 93.6 MBytes 46.8 MBytes
/sec
11983
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost
/Total
Datagrams
[ 4] 0.00-10.00 sec 467 MBytes 46.7 MBytes
/sec
0.037 ms 435
/59760
(0.73%)
[ 4] Sent 59760 datagrams
iperf Done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#在服务端的输出
Accepted connection from 192.168.1.209, port 58179
[ 5]
local
192.168.1.250 port 5201 connected to 192.168.1.209 port 45424
[ ID] Interval Transfer Bandwidth Jitter Lost
/Total
Datagrams
[ 5] 0.00-1.00 sec 35.6 MBytes 299 Mbits
/sec
0.054 ms 29
/4590
(0.63%)
[ 5] 1.00-2.00 sec 43.0 MBytes 361 Mbits
/sec
0.071 ms 30
/5533
(0.54%)
[ 5] 2.00-3.00 sec 48.4 MBytes 406 Mbits
/sec
0.154 ms 29
/6225
(0.47%)
[ 5] 3.00-4.00 sec 45.6 MBytes 382 Mbits
/sec
0.026 ms 6
/5837
(0.1%)
[ 5] 4.00-5.00 sec 47.3 MBytes 397 Mbits
/sec
0.168 ms 124
/6183
(2%)
[ 5] 5.00-6.00 sec 46.1 MBytes 387 Mbits
/sec
0.023 ms 40
/5941
(0.67%)
[ 5] 6.00-7.00 sec 49.0 MBytes 411 Mbits
/sec
0.022 ms 48
/6322
(0.76%)
[ 5] 7.00-8.00 sec 53.1 MBytes 446 Mbits
/sec
0.037 ms 67
/6867
(0.98%)
[ 5] 8.00-9.00 sec 44.9 MBytes 376 Mbits
/sec
0.163 ms 26
/5769
(0.45%)
[ 5] 9.00-10.00 sec 48.4 MBytes 406 Mbits
/sec
0.015 ms 36
/6232
(0.58%)
[ 5] 10.00-10.04 sec 2.04 MBytes 426 Mbits
/sec
0.037 ms 0
/261
(0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost
/Total
Datagrams
[ 5] 0.00-10.04 sec 0.00 Bytes 0.00 bits
/sec
0.037 ms 435
/59760
(0.73%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
阅读全文
0 0
- Linux网络性能评估工具iperf
- 网络性能评估工具Iperf
- 网络性能评估工具Iperf详解
- 网络性能评估工具Iperf详解
- 安全运维之:网络性能评估工具Iperf详解
- 嵌入式linux网络性能测试工具iperf
- linux网络性能测试工具 iperf
- linux 网络性能测试工具iperf
- iperf-网络性能测量工具
- 网络性能测试工具--iperf
- iperf工具测试网络性能
- 网络性能测试工具Iperf
- iperf 网络性能测试工具
- Iperf网络性能监测工具
- iperf网络性能测试工具
- 简谈linux环境下网络性能测试工具iperf
- linux网络性能测试工具Iperf使用介绍
- Linux 网络性能测试工具 iperf 的安装和使用
- MYSQL之表连接
- C++编程中const和#define的区别
- Redis 学习笔记
- 全是1的最大子矩阵
- 激活函数总结(一)
- Linux网络性能评估工具iperf
- 代码3 爬取贴吧多页数据
- redis的使用
- Android 设计模式
- Java初级入门
- NS2整体实现机制(转)
- 解决滑动条控件,子物体减少,滑动条不刷新的bug
- Java面试题二:基础语法(续面试题一)
- EventBus使用