[Study notes] Iperf3 network performance testing tool

[Study notes] Iperf3 network performance testing tool

Network performance evaluation is mainly to monitor the utilization rate of network bandwidth, and maximize the utilization of network bandwidth is the basis for ensuring network performance. However, due to unreasonable network design and network security vulnerabilities, network bandwidth utilization will not be high. To find the cause of low network bandwidth utilization, you need to monitor the network transmission. At this time, you need to use some network performance evaluation tools, and Iperf is such a network bandwidth test tool.

1. Introduction to Iperf

1. What is iperf?

Iperf is an open source network performance testing tool developed by the University of Illinois. It can be used to test the performance of TCP or UDP connections between network nodes (including loopback), including bandwidth, jitter, and packet loss rate. Jitter and packet loss rate are suitable for UDP testing, while bandwidth testing is suitable for TCP and UDP.

Iperf is a network performance test tool based on TCP / IP and UDP / IP. It can be used to measure network bandwidth and network quality, and provide statistical information such as network delay jitter, packet loss rate, and maximum transmission unit. Network administrators can understand and judge network performance problems based on this information, thereby locating network bottlenecks and solving network failures.

Iperf is a network performance testing tool based on the command line mode. It is cross-platform and provides full platform support across Windows, Linux, and Mac. iperf uses memory as a send / receive buffer throughout the process, is not affected by disk performance, and has very low requirements for machine configuration. However, because it is a command line tool, iperf does not support the output of test patterns.

Iperf can test the bandwidth quality of TCP and UDP, with a variety of parameters and UDP characteristics, can be used to test the performance of some network devices such as routers, firewalls, switches, etc.

2. Functions of Iperf
(1) TCP

① Measuring network bandwidth

② Report the size and observation of MSS / MTU value

③ Support TCP window value through socket buffer

④ When P thread or Win32 thread is available, support multi-thread. Client and server support simultaneous multiple connections

(2) UDP

① Client can create UDP stream with specified bandwidth

② Measuring packet loss

③ Measurement delay

④ Support multicast

⑤ When P thread is available, support multi-thread. Client and server support multiple simultaneous connections (Windows is not supported)

(3) Other aspects

① Where appropriate, K (kilo-) and M (mega-) can be used as options. For example, 131072 bytes can be replaced with 128K.

② You can specify the total running time and even set the total amount of data transferred.

③ In the report, select the most suitable unit for the data.

④ The server supports multiple connections instead of waiting for a single-threaded test.

⑤ Repeatedly display network bandwidth, fluctuation and packet loss at specified time intervals.

⑥ The server can be run as a background program.

⑦ The server can be run as a Windows service.

⑧ Use typical data flow to test the impact of link layer compression on available bandwidth.

Second, the installation of Iperf

1. The version of iperf

Iperf has two versions, windows version and linux version.

(1) Unix / Linux version

The Unix / Linux version is updated faster and the latest version. The latest version is iperf3.0.

Linux version download address: http://code.google.com/p/iperf/downloads/list

In order to test the accuracy, try to use linux environment test.

(2) Windows version

The Windows version of iperf is called jperf, or xjperf, which is slow to update. The latest version is currently 1.7 (packaged in jperf).

Windows version download address: http://sourceforge.net/projects/iperf/files/jperf/jperf 2.0.0 /

jperf is a graphical interface program developed on the basis of iperf, which simplifies the construction of complex command-line parameters, and can also save the test results, while displaying the results graphically in real time.

2. Installation of iperf for Windows

For the windows version of iperf, download the installation package and unzip it directly, then copy the decompressed iperf.exe and cygwin1.dll to the% systemroot% directory.

3. Installation of iperf for Linux
(1) Online installation:

CentOS installation:yum install -y iperf3

Debian and Ubuntu installation:apt-get install iperf3

(2) Offline installation: download the corresponding version of the installation package

gunzip -c iperf- .tar.gz | tar -xvf - cd iperf- ./configure make make install

Three, the use of Iperf

1. The working mode of Iperf

Iperf can run on any IP network, including local Ethernet, Internet access, Wi-Fi network, etc. In working mode, iperf runs in server and client mode. Its server is mainly used to listen for incoming test requests , and the client is mainly used to initiate test connection sessions . Therefore, at least two servers and one are required to use iperf Run in server mode, the other runs in client mode.

After completing the installation of iperf, execute "iperf3 -h" to display the detailed usage of iperf. The command line options of iperf are divided into three categories, which are client-side and server-side common options, server-side special options and client-side special options.

2. Common parameters of Iperf (enough test)

(1) -s, --server: iperf server mode, the default listening port is 5201, eg: iperf -s

(2) -c, --client host: iperf client mode, host is the server address, eg: iperf -c 222.35.11.23

(3) -i, --interval: Specify the time interval between each report, in seconds, eg: iperf3 -c 192.168.12.168 -i 2

(4) -p, --port: Specify the port that the server monitors or the port that the client connects to. The default is port 5001.

(5) -u, --udp: indicates that the UDP protocol is used to send packets, without this parameter indicates that the TCP protocol is used.

(6) -l, --len: Set the length of the read-write buffer, the unit is Byte. The TCP mode defaults to 8KB, and the UDP mode defaults to 1470 bytes. Usually the value is 16 when testing PPS, and 1400 when testing BPS.

(7) -b, --bandwidth [K | M | G]: Specify the bandwidth used in UDP mode, in bits / sec. The default value is 1 Mbit / sec.

(8) -t, --time: Specify the total time for data transmission, that is, repeatedly send data packets of the specified length within the specified time. The default is 10 seconds.

(9) -A: CPU affinity, you can bind the specific iperf3 process to the corresponding numbered logical CPU to avoid the iperf process scheduling between different CPUs.

3. Common parameters (shared by Server and Client)

(1) -f, --farmat [k | m | g | K | M | G]: Specify the bandwidth output unit, "[k | m | g | K | M | G]" means Kbits, Mbits, Gbits, KBytes, MBytes, GBytes display the output results, the default Mbits, eg: iperf3 -c 192.168.12.168 -f M

(2) -p, --port: Specify the port that the server monitors or the port that the client is connected to. The default is port 5001.

(3) -i, --interval: Specify the time interval between each report, in seconds, eg: iperf3 -c 192.168.12.168 -i 2

(4) -F: Specify the file as a data stream for bandwidth testing. For example: iperf3 -c 192.168.12.168 -F web-ixdba.tar.gz

4. Server-specific parameters

(1) -s, --server: iperf server mode, the default listening port is 5201, eg: iperf -s

(2) -c, --client host: If iperf runs in server mode and specifies a host with the -c parameter, iperf will only accept connections from the specified host. This parameter cannot work in UDP mode.

(3) -D: Run Iperf as a background daemon on the Unix platform. Under the Win32 platform, Iperf will run as a service.

(4) -R: uninstall Iperf service (only for Windows).

(5) -o: redirect the output to the specified file (only for Windows).

(6) -P, --parallel: The number of connections maintained before the server is shut down. The default is 0, which means that the connection is always accepted.

5. Client-specific parameters

(1) -c, --client host: iperf client mode, host is the server address, eg: iperf -c 222.35.11.23

(2) -u, --udp: indicates that the UDP protocol is used to send the message, without this parameter indicates that the TCP protocol is used.

(3) -b, --bandwidth [K | M | G]: Specify the bandwidth used in UDP mode, in bits / sec. The default value is 1 Mbit / sec.

(4) -t, --time: Specify the total time for data transmission, that is, repeatedly send data packets of the specified length within the specified time. The default is 10 seconds.

(5) -l, --len: Set the length of the read-write buffer, the unit is Byte. TCP default is 8KB, UDP default is 1470 bytes. Usually the value is 16 when testing PPS, and 1400 when testing BPS.

(6) -n, --num [K | M | G]: Specify the number of bytes of the transmitted data packet, for example: iperf3 -c 192.168.12.168 –n 100M

(7) -P, --parallel: Specify the number of threads used between the client and the server. The default is 1 thread. The client and server need to use this parameter at the same time.

(8) -w, --window: Specify the socket buffer size. In TCP mode, this setting is the size of the TCP window. In UDP mode, this setting is the buffer size for receiving UDP packets, which is used to limit the maximum value of packets that can be received

(9) -B, --bind: Used to bind a host address or interface. This parameter is only used for hosts with multiple network interfaces. In UDP mode, this parameter is used to bind and join a multicast group.

(10) -M, --mss: set the value of the TCP maximum information segment

(11) -N, --nodelay: set TCP without delay

(12) -V: Bind an IPv6 address.

(13) -d, --dualtest: Run dual test mode. The server will be connected to the client in reverse, using the port specified in the -L parameter (or the port used by the client to connect to the server by default). Use the parameter -r to run interactive mode.

(14) -L, --listenport: Specify the port used when the server connects back to the client. By default, the client connects to the server port.

(15) -r, --tradeoff: reciprocating test mode. When the client-to-server test ends, the server connects back to the client. When the client connection is terminated, the reverse connection starts immediately. If you need to perform a two-way test at the same time, try the -d parameter.

6. Other parameters

(1) -h, --help: display the command line reference and exit.

[root]# iperf3 -h  
Usage: iperf3  [-s|-c host] [options]  
iperf3 [-h|--help] [-v|--version]

(2) -v, --version: Display version information and compilation information and exit.

Four, Iperf use examples

1. Environmental preparation:

(1) Server-side IP address: 192.168.0.120

(2) Server-side IP address: 192.168.0.121

2. Test TCP throughput
(1) On the server side, start the server mode of iperf and specify the TCP port:
[root@iperf-server  ~]# iperf3 -s -i 1 -p  520  
------------------------------------------------------------  
Server listening  on TCP port 520  
TCP window size:  85.3 KByte (default)  
------------------------------------------------------------ 
(2) The client starts the iperf client mode and connects to the server
[root@iperf-client  ~]# iperf -c 192.168.0.120  -i 1 -t 60 -p 520  
------------------------------------------------------------  
Client connecting  to 192.168.0.120, TCP port 520  
TCP window size:  45.0 KByte (default)  
------------------------------------------------------------  
[ 3] local 192.168.0.121  port 50616 connected with 192.168.0.120 port 520  
[ ID] Interval  Transfer Bandwidth  
[ 3] 0.0-10.1 sec  1.27 GBytes 1.08 Gbits/sec     
(3) Server-side monitoring results
------------------------------------------------------------  
Server listening  on TCP port 5001  TCP window size:  85.3 KByte (default)  
------------------------------------------------------------  
[ 4] local 192.168.0.120  port 520 connected with 192.168.0.121 port 50616  
[ ID] Interval  Transfer Bandwidth  
[ 4] 0.0-10.1 sec  1.27 GBytes 1.08 Gbits/sec  

① Interval means time interval.

② Transfer represents the amount of data transferred in the time interval.

③ Bandwidth is the transmission rate in the time interval.

(4) Test multi-thread TCP throughput

If no sending method is specified, the iPerf client will only use a single thread.

iperf3 -c 192.168.0.120 -P 30 -t 60  
(5) Conduct upstream and downstream bandwidth tests (two-way transmission)
iperf3 -c 192.168.0.120 -d -t 60
(6) Stop the iperf3 service process

To stop the iperf3 service process, press CTRL + z or CTRL + c

The Executive sar command to end the Server statistical package actually received as actual results: sar -n DEV 1 320.

3. Test UDP throughput

Bandwidth testing usually uses UDP mode, because it can measure the limit bandwidth, delay jitter, and packet loss rate. When testing, first use the theoretical bandwidth of the link as the data transmission rate. For example, the theoretical bandwidth of the link from the client to the server is 100Mbps. Use -b 100M to test first, and then based on the test results (including Actual bandwidth, delay jitter and packet loss rate), and then use the actual bandwidth as the data transmission rate to test, you will find that the delay jitter and packet loss rate are much better than the first time, repeat the test several times, you can get a stable Actual bandwidth.

(1) On the server side, start the server mode of iperf and specify the UDP port:
[root@iperf-server  ~]# iperf3 -s -i 1 -p  521  
------------------------------------------------------------  
Server listening  on port 521  
------------------------------------------------------------
(2) The client starts the iperf client mode and connects to the server
[root@iperf-client  ~]# iperf3 -u -c 192.168.0.120  -b 100m -t 60 -p 521  
------------------------------------------------------------  
Client connecting  to 192.168.0.120, port 521  
------------------------------------------------------------  
[ 3] local 192.168.0.121  port 50616 connected with 192.168.0.120 port 521  
[ ID] Interval  Transfer Bandwidth TotalDatagrams   
[ 3] 0.0-10.1 sec  1.27 GBytes 1.08 Gbits/sec 82
(3) Server-side monitoring results
------------------------------------------------------------  
Server listening  on port 521  
------------------------------------------------------------  
[ 4] local 192.168.0.120  port 520 connected with 192.168.0.121 port 50616  
[ ID] Interval  Transfer Bandwidth Jitter Lost/Total Datagrams  
[ 4] 0.0-10.1 sec  1.27 GBytes 1.08 Gbits/sec 0.007 ms 0/82 (0%)

① Jitter is jitter, the smooth average difference in continuous transmission.

② Lost is the number of lost packets.

③ Total Datagrams is the number of packets.

(4) Test multi-thread UDP throughput

If no sending method is specified, the iPerf client will only use a single thread.

iperf3 -u -c  192.168.1.1 -b 5M -P 30 -t 60  
(5) Conduct upstream and downstream bandwidth tests (two-way transmission)
iperf3 -u -c  192.168.1.1 -b 100M -d -t 60 

V. Introduction to Jperf

1. Introduction to Jperf

jperf is a graphical interface program developed based on iperf, which simplifies the construction of complex command-line parameters, and can also save test results, while displaying the results graphically in real time. JPerf can test the bandwidth quality of TCP and UDP. JPerf can measure the maximum TCP bandwidth, with a variety of parameters and UDP characteristics. JPerf can report bandwidth, delay jitter and packet loss.

2. JPerf2.0 operating environment

(1) Operating system: Java running environment

(2) Network requirements: Jperf can run on any IP network, including local Ethernet, Internet access connection and Wi-Fi network.

(3) Other requirements: JPerf must install two components: JPerf server and JPerf client.

3. Introduction of JPerf2.0 page

JPerf2.0 page

(1) Iperf command line (can not be directly input)

Iperf command line

① Server setting

Server settings

❶ Monitoring port: 5001

❷ client limit: client limit, only allow specified client to connect

❸ Num Connections: the maximum number of connections allowed, 0 is unlimited

② Client settings

Client settings

Server address: 10.0.115.82, port: 5001, concurrent stream: 1

(2) Application layer settings

Application layer settings

① Compatible with the old version (used when the server and client versions are different)

Compatible with older versions

② Set the test mode: the total size of transmitted bytes is 15Bytes or the total length of transmission time is 15 seconds

Set test mode

③ Simultaneous bidirectional transmission test

Simultaneous two-way transmission test

④ Carry out the two-way transmission test separately, first measure the bandwidth from c to s

Separate bidirectional transmission test

⑤ Specify the file to be transferred

Specify the file to be transferred

⑥ Display tcp maximum mtu value

Show tcp max mtu value

(3) Transport layer settings

① TCP protocol

❶ Set the buffer size

Set buffer size

❷ Specify TCP window size

Specify TCP window size

❸ Set the maximum mtu value of TCP packets

Set the maximum mtu value of TCP packets

❹ Set TCP without delay

Set TCP without delay

② UDP protocol

❶ Set the maximum bandwidth of UDP

Set the maximum UDP bandwidth

❷ Set UDP buffer

Set UDP buffer

❸ UDP packet encapsulation size: default 1470 byte

UDP packet encapsulation size

③ IP layer setting

IP layer settings

❶ Specify ttl value

Specify ttl value

❷ Type of Service (ToS), the size ranges from 0x10 (minimum delay) to 0x2 (minimum cost)

Service type

Download link for this article

Appendix: References

1. "Network Performance Test Method"

Author: Ali cloud help documentation

Address: https://help.aliyun.com/knowledge_detail/55757.html#HFXbx

2. "iperf-Baidu Encyclopedia" (article)

Author: Baidu Wikipedia users

Address: https://baike.baidu.com/item/iperf/11067694?fr=aladdin

3. "Linux network performance evaluation tools iperf, CHARIOT test network throughput" (article)

Author: Konglingbin

Address: https://www.cnblogs.com/klb561/p/9215952.html

4. "Linux Command Daquan -iperf Command"

Author: uncertain

Address: https://man.linuxde.net/iperf

5. "Network Performance Test Tool iPerf Function and Usage Tutorial"

Author: uncertain

Address: http://www.veryhuo.com/a/view/159685.html

6. "IPerf Graphic Tool Jperf Graphic Use Tutorial"

Author: uncertain

Address: http://www.veryhuo.com/a/view/159704.html

7. "Using iPerf for network throughput test"

Author: Let the fans

Address: https://www.jianshu.com/p/15f888309c72

Guess you like

Origin www.cnblogs.com/davidesun/p/12720953.html