|
This post was last edited by flylzy on 2020-1-1 15:24
To test the transmission speed of the network line, everyone's usual practice is basically to use the most earthy way, which is to copy and share files! But those who find it professional are using iperf2 or iperf3 tools. In order to be elegant and fashionable, I also Baidu, now I learn and sell, and share it with you. Please correct the fallacies, and welcome to add the omissions, and think together and make progress together.
Think about the goal: Use iperf3 to test the network speed
Knowledge points:
1. In the windows system, iperf3.exe run through the cmd command line, that is, there is no UI;
2. iperf3 can run multiple instances at the same time. i.e. running multiple at the same time;
3. The test principle of iperf3 is realized by transferring data between the server and the client;
- The default test data transmission direction is client->server; To test the reverse bandwidth, you can use the parameter -R to flip the direction;
- Disadvantages: iperf3 no longer supports full-duplex mode testing, iperf2 is said to support full-duplex mode;
- Cons: Doesn't seem to support multiple clients for testing at the same time;
4. The iperf3 software itself is divided into serverless version and client version, but the working mode can be set by specifying parameters.
-s is server, table server mode; -c is client, table client mode;
5. IP address 127.0.0.1 refers to local/local, that is, the device is self-body.
6. iperf3 supports lan<--> and wan<-->lan path testing
Experimental Methods
* Devices: PC, router, mobile phone
* Connection: PC --- Router --- Mobile Phone (PC and mobile phone, in the same LAN)
PC --- Router 1 --- Router 2 --- Mobile Phone (Upper/Lower-level Network; The WAN port of PC and Route 2 is connected to the LAN port of Route 1)
* Tools: iperf3.exe, magic iperf.apk,
Attachment download: Link: https://pan.baidu.com/s/149zMdPt8liDe-EFX7o84qg Extraction code: XL3C
Install the software
Download the attachment, unzip it, and select the corresponding version based on the system.
For Windows system, for ease of use, it is recommended to copy all the program files directly after decompression to the C:\Windows\System32 folder, so that it can be run directly in cmd. If it is placed in another directory, you need to use the cd command to jump to it.
Android mobile version, the accessory program, the minimum system requirements for the installation and running environment is Android5.0
use
Example 1: Test the local loop speed of the computer to understand the CPU processing speed limit.
Run 2 instances on the computer, one as the server and one as the client.
cmd window 1, do the server, enter the command: iperf3 -s
cmd window 2, do the client, enter the command: iperf3 -c 127.0.0.1 -t 5 #参数 -t 5 The table test is 5 seconds, and the duration can be customized
Example 2: Test the transmission speed of the computer-router-mobile phone. Assume that the PC intranet IP address is 192.168.2.100 and the mobile phone intranet IP address is 192.168.2.102
Run iperf3 on your computer and let it work in server mode, i.e.:
iperf3 -s # -s The table runs in server mode
Then run this app on your phone Magic iperf.apk and select iperf3 version. After entering the following command, click on the right side of STOPPED in the upper right corner, which is started
1) By default traffic direction (client-side --->-server)
-c 192.168.2.100 -t 5 # -c table client mode; IP addressis the address where the server is located; -t 5 The table test is 5 seconds, and the duration can be customized.
2) Flip the direction of the data flow (server-side --->-client)
-c 192.168.2.100 -R -t 5 # -R The parameter, i.e., Reverse, flips the direction of the data stream
Note: This is only a one-way transmission test!
After giving these two simple examples, I believe you can roughly understand how it works, this is just for throwing bricks and jade, there are many other control parameters available, please refer to the manual, enter iperf3 -h enter to see.
ponder: The client and the server of iperf3 can communicate in the LAN at the same time, if the server is placed in the WAN port (i.e., the higher-level network), can it communicate? My guess is yes, to be verified.
Attachment download: Link: https://pan.baidu.com/s/149zMdPt8liDe-EFX7o84qg Extraction code: XL3C
---------------------------------------------------
iperf3 syntax description:
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
-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
-------------------------------------------------
Chinese instructions (I don't know which version, you can refer to it!) )
Grammar:
Common parameters for server and client:
-f [k|m|K| M|g| G] --format, which indicates that the report is displayed in Kbits, Mbits, KBytes, MBytes, Gbits, and GBytes, respectively.
By default, the unit is Mbits, e.g.: iperf -c 192.168.1.105 -f K
Note: Theoretical K = 1024, while in iperf K = 1000
-i # --interval sets the time interval between each report, which is 1 second by default. eg:iperf -c 222.35.11.23 –I 2
-l, --len # [KM] Sets the length of the read/write buffer. The default value is 8 KB in TCP mode and 1470 bytes in UDP mode.
-m, --print_mss output TCP MSS value (supported by TCP_MAXSEG). The MSS value is generally 40 bytes smaller than the MTU value. Usually
-p, --port # set the port to be the same as the listening port on the server. The default is port 5001, which is the same as for TTCP.
-u, --udp uses UDP instead of TCP. See -b option.
-w, --window # [KM] sets the socket buffer to the specified size. The default is 8 KB. For TCP mode, this setting is the TCP window size. For UDP mode, this setting is set to the buffer size that accepts UDP packets, limiting the maximum number of packets that can be accepted.
-B, --bind host is bound to one of the multiple addresses of the host. For the client, this parameter sets the e-stack interface. For the server, this parameter is set to the inbound interface. This parameter is only used for hosts with multiple network interfaces. In Iperf's UDP mode, this parameter is used to bind and join a multicast group. Multicast addresses in the range 224.0.0.0 to 239.255.255.255 are used. Refer to the -T parameter.
-C, --compatibility
Compatibility mode can be used when used with earlier versions of Iperf. It is not necessary to use compatibility mode on both ends, but it is highly recommended to use compatibility mode on both sides at the same time. In some cases, the use of certain data streams can cause a server-side crash in version 1.7 or cause unintended connection attempts.
-M, --mss #[KM}
Try to set the value of the TCP maximum information segment via the TCP_MAXSEG option. The size of the MSS value is usually TCP/IP header minus 40 bytes. In Ethernet, the MSS value is 1460 bytes (MTU1500 bytes). Many operating systems do not support this option.
-N, --nodelay
Set the TCP No Latency option and disable Nagle's algorithm. Usually this option is disabled for interactive programs, such as telnet.
-V (from v1.6 or higher)
Bind an IPv6 address.
Server: $ iperf -s –V
Client: $iperf -c <Server IPv6 Address> -V
Note: In 1.6.3 or later, specifying an IPv6 address does not require the -B parameter binding, and in versions prior to 1.6. In most operating systems, the IPv4 address mapped by the IPv4 client will be responded.
Server-side dedicated options
-s, --server runs as a server mode
-D (v1.2 or later) Iperf runs as a daemon on Unix platforms. Under the Win32 platform, Iperf will run as a service.
-R (v1.2 or later, Windows only) Uninstall the Iperf service if it is running.
-o (v1.2 or later, Windows only) Redirect output to the specified file
-c client host_ip --client host If you specify a host on the server side with the -c parameter, then Iperf will only accept connections from the specified host. This parameter cannot work in UDP mode.
-P # --The number of connections maintained before the parallel server was closed. The default is 0, which means that connections are always accepted.
Client-specific options
-c server ip --client host runs in client mode and connects to the specified Iperf server.
-b, #[KM] --bandwidth The bandwidth used in UDP mode, in bits/sec. This option is related to the -u option. The default value is 1 Mbit/sec.
-d, --dualtest
Run a dual test mode. This will cause the server side to connect to the client in reverse, using the port specified in the -L parameter (or by default, using the port where the client connects to the server side). This is done immediately at the same time as the operation.
If you want an interactive test, try the -r parameter.
-n, --num #[KM]
The number of buffers transferred. Typically, Iperf sends data on a 10-second basis. The -n parameter crosses this limit to send a specified length of data as many times as it wants, regardless of how long the operation takes. Refer to the -l and -t options.
-r, --tradeoff
Reciprocating test mode. When the client-to-server test ends, the server backconnects to the client via the port specified in the -l option (or the port where the client connects to the server by default). When the client connection is terminated, the reverse connection begins.
If you need to test both sides at the same time, try the -d parameter.
-t, --time #
Sets the total time for the transfer. Iperf repeatedly sends packets of a specified length within a specified amount of time. The default is 10 seconds. Refer to the -l and -n options.
-L, --listenport #
Specifies the port to be used when the server backconnects to the client. By default, the port that connects the client to the server is used.
-P, --parallel #
Number of threads. Specifies the number of threads to be used between the client and the server. The default is 1 thread. This parameter needs to be used on both the client and server side.
-S, --tos #
The service type of the egress stack packet. Many routers ignore the TOS field. You can specify this value by using a hexadecimal number starting with "0x", or an octal or decimal number starting with "0".
For example, hexadecimal '0x10' = octal '020' = decimal '16'. The TOS value of 1349 is:
IPTOS_LOWDELAY minimize delay 0x10
IPTOS_THROUGHPUT maximize throughput 0x08
IPTOS_RELIABILITY maximize reliability 0x04
IPTOS_LOWCOST minimize cost 0x02
-T, --ttl #
The TTL value of the e-stack multicast packet. This is essentially the number of hops that data passes through the router. The default value is 1, and the link is local.
-F (from v1.2 or higher)
Bandwidth is measured using a specific data stream, such as a specified file.
$ iperf -c <server address> -F <file-name>
-I (from v1.2 or higher)
As with -F, data is entered from a standard input output file.
other
-h, --help displays the command-line reference and exits .
-v, --version displays version and compilation information and exits.
|
More resources are included in this post
You need login Can you download or view without an account?Sign up now
×
Score
-
See all ratings
|