Remote host (server): Ubuntu 18.04
Local host (client): Mac (installed HomeBrew)
Reason: Because our local machine cannot be accessed by external machines, the server can only be hosted by external machines, without affecting the performance test results.
Installation#
Actually, the installation is very simple, just need to configure the environment.
Ubuntu installation:
$ sudo apt install iperf3
Mac installation:
$ brew install iperf3
That's it, the server and client only need to configure different parameters.
Usage#
Server:
$ iperf3 -s -i 2
Client:
$ iperf3 -c 192.xxx.xxx.xxx -i 2
If you want to test the upload speed, then add -R
when executing the client, like this:
$ iperf3 -c 192.xxx.xxx.xxx -i 2 -R
Parameter Description#
Common parameters:
- -p, --port [PORT], the port number that the server listens on and the client connects to;
- -f, --format [TYPE], the unit of data used in the report, Kbits, Mbits, KBytes, Mbytes;
- -i, --interval [TIME], the interval between each report, in seconds;
- -F, --file [NAME], the file name used for testing. If used on the client side, the file is sent for testing; if used on the server side, the data is written to the file instead of being discarded;
- -A, --affinity n/n,m, set CPU affinity;
- -B, --bind, bind to the specified network interface;
- -V, --verbose, output more details at runtime;
- -J, --json, output results in JSON format at runtime;
- --logfile f, output to file;
- -d, --debug, output results in debug mode;
- -v, --version, display version information and exit;
- -h, --help, display help information and exit.
Server-side parameters:
- -s, --server, run in server mode;
- -D, --daemon, run in the background as a daemon;
- -I, --pidfile [FILE], specify the pid file;
- -1, --one-off, only accept 1 test from the client side, then exit.
Client-side parameters:
- -c, --client, run in client mode and specify the address of the server side;
- -u, --udp, perform the test using the UDP protocol;
- -b, --bandwidth [TYPE], limit the test bandwidth. UDP defaults to 1Mbit/second, TCP has no limit by default;
- -t, --time [TIME], perform the test until the specified time, default is 10 seconds;
- -n, --bytes [TYPE], perform the test until the specified amount of data is transferred;
- -k, --blockcount [TYPE], perform the test until the specified number of data packets are transferred;
- -l, --len [TYPE], the length of the read/write buffer, TCP defaults to 128K, UDP defaults to 8K;
- --cport, specify the TCP or UDP port used by the client, default is a temporary port;
- -P, --parallel, test with multiple concurrent data streams;
- -R, --reverse, run in reverse mode (server sends, client receives);
- -w, --window [TYPE], set the socket buffer size, window size in TCP mode;
- -C, --congestion, set the TCP congestion control algorithm (only supported on Linux and FreeBSD);
- -M, --set-mss, set the maximum segment size (MSS) for TCP/SCTP (MTU minus 40 bytes);
- -N, --no-delay, set TCP/SCTP no delay, disable Nagle's algorithm;
- -4, --version4, use only IPv4;
- -6, --version6, use only IPv6;
- -S, --tos N, set the IP type of service (TOS);
- -L, --flowlabel N, set the IPv6 flow label (only supported on Linux);
- -Z, --zerocopy, send data using "zero copy" method;
- -O, --omit N, ignore the first n seconds of the test;
- -T, --title str, set the prefix for each line of test results;
- --get-server-output, get test results from the server side;
- --udp-counters-64bit, use 64-bit counters in UDP test packets (to prevent counter overflow)
In actual use, there is no need for so many parameters, you can look them up yourself.
—EOF—