8. iperf3测速 中
Using iperf3 to test connection speed between different hosts.
- Install iperf3
# CentOS
yum -y install iperf3
dnf install iperf3
# Ubuntu
apt-get -y install iperf3
# Alpine
apk add iperf3
# Arch Linux
pacman -S iperf3
# Windows iperf3 download links
# https://files.budman.pw/
# https://github.com/ar51an/iperf3-win-builds
- iperf3 Speed Test Usage
iperf3 -s -p 5201
Where:
-sindicates server mode-pspecifies the port to use (default port 5201. Don’t forget to allow the port in the firewall)-Druns as a daemon in the background, add the -D parameter
Then initiate the speed test from the local machine.
iperf3 -c 1.1.1.31 -p 5201 -t 30 -P 5 -R
Where:
-cindicates client mode and specifies the speed test server address-pspecifies the server port-tspecifies the test duration (in seconds)-Pspecifies the number of concurrent connections (higher values help test speed limits)-Ris for reverse testing, indicating download speed test (without this parameter, upload speed is tested)-uto test UDP connections, add the -u parameter-ispecifies the test interval in seconds
The [SUM] line contains the test data (based on the receiver), with an average bandwidth speed of 74.9 Mbits per second.
root@cloudcone-42:~# iperf3 -c 1.1.1.31 -p 5201 -i 1 -t 10 -P 5 -R
Connecting to host 1.1.1.31, port 5201
Reverse mode, remote host 1.1.1.31 is sending
[ 5] local 64.69.40.42 port 55344 connected to 1.1.1.31 port 5201 # 5 threads started. The number in brackets at the beginning is the thread ID, mainly to distinguish each thread in the following data.
[ 7] local 64.69.40.42 port 55356 connected to 1.1.1.31 port 5201 # All five threads successfully connected to the server, default port 5001
[ 9] local 64.69.40.42 port 55366 connected to 1.1.1.31 port 5201
[ 11] local 64.69.40.42 port 55370 connected to 1.1.1.31 port 5201
[ 13] local 64.69.40.42 port 55378 connected to 1.1.1.31 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 15.8 MBytes 133 Mbits/sec # First column, interval, indicates the time range
[ 7] 0.00-1.00 sec 15.2 MBytes 128 Mbits/sec # Second column, transfer, indicates the amount of data transferred
[ 9] 0.00-1.00 sec 25.8 MBytes 216 Mbits/sec # Third column, bandwidth, indicates the transmission bandwidth
[ 11] 0.00-1.00 sec 22.7 MBytes 190 Mbits/sec
[ 13] 0.00-1.00 sec 23.3 MBytes 196 Mbits/sec # Since multiple threads are running simultaneously, the bandwidth of each thread is not the actual bandwidth
[SUM] 0.00-1.00 sec 103 MBytes 863 Mbits/sec # The actual bandwidth is indicated by the SUM row. Our client command summarizes bandwidth reports every 1s, so adding the bandwidth of threads in the same time interval roughly equals the actual SUM bandwidth.
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 29.00-30.00 sec 12.0 MBytes 101 Mbits/sec
[ 7] 29.00-30.00 sec 17.6 MBytes 147 Mbits/sec
[ 9] 29.00-30.00 sec 26.9 MBytes 226 Mbits/sec
[ 11] 29.00-30.00 sec 25.7 MBytes 215 Mbits/sec
[ 13] 29.00-30.00 sec 24.7 MBytes 207 Mbits/sec
[SUM] 29.00-30.00 sec 107 MBytes 896 Mbits/sec
...
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 191 MBytes 160 Mbits/sec 968 sender
[ 5] 0.00-10.00 sec 189 MBytes 158 Mbits/sec receiver
[ 7] 0.00-10.00 sec 196 MBytes 165 Mbits/sec 873 sender
[ 7] 0.00-10.00 sec 193 MBytes 162 Mbits/sec receiver
[ 9] 0.00-10.00 sec 290 MBytes 244 Mbits/sec 1284 sender
[ 9] 0.00-10.00 sec 287 MBytes 241 Mbits/sec receiver
[ 11] 0.00-10.00 sec 161 MBytes 135 Mbits/sec 744 sender
[ 11] 0.00-10.00 sec 160 MBytes 134 Mbits/sec receiver
[ 13] 0.00-10.00 sec 156 MBytes 131 Mbits/sec 724 sender
[ 13] 0.00-10.00 sec 155 MBytes 130 Mbits/sec receiver
[SUM] 0.00-10.00 sec 995 MBytes 835 Mbits/sec 4593 sender
[SUM] 0.00-10.00 sec 984 MBytes 826 Mbits/sec receiver
iperf Done.
Test Result Interpretation:
Concurrent Streams:
The test shows 5 concurrent streams (stream IDs 5, 7, 9, 11, 13), with the transmission details for each stream as follows:
[ 5]
Transfer: 18.7 MB (approx. 157 Mbps)
Send Rate: 160 Mbps
Receive Rate: 158 Mbps
Retransmissions: 968
...
[ 13]
Transfer: 17.0 MB (approx. 142 Mbps)
Send Rate: 131 Mbps
Receive Rate: 130 Mbps
Retransmissions: 724
Total Statistics:
Total Sent: 995 MB (approx. 835 Mbps)
Total Received: 984 MB (approx. 826 Mbps)
Total Retransmissions: 4593
Analysis:
Throughput: Through testing with 5 concurrent streams, the receiver received approximately 984 MB of data in total, and the sender sent approximately 995 MB. The overall throughput is roughly between 826 - 835 Mbps, indicating relatively stable network connection performance.
Retransmissions: The number of retransmissions (4593) indicates some packet loss occurred during transmission. While the packet loss is not extremely severe, the presence of retransmissions suggests the network is not completely error-free.
Speed Differences Between Streams: Stream 9’s transfer volume is significantly higher than other streams (252 Mbps), while streams 11 and 13 have lower rates (139 Mbps and 142 Mbps). This may indicate that network load balancing between different streams is not entirely uniform, or some streams are limited by network bottlenecks or other factors.
Summary:
The test results show that the average network connection speed over 10 seconds is approximately 835 Mbps (sent) and 826 Mbps (received), which is relatively ideal.
Although there are some retransmissions, there is no significant packet loss, and the variation in stream transmission rates suggests possible uneven network load or other factors affecting stream performance.