NotePublic/Software/Applications/IPerf/IPerf_使用说明.md

65 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# IPerf 使用说明
IPerf 可用于网络带宽测试,可在 Windows、Linux、Android、MacOS 和 iOS 系统下运行。主要有 IPerf2 和 IPerf3 两大版本。
IPerf 可做为 Server 端或 Client 端运行Client 发起与 Server 端的通讯,并对通讯性能进行分析。
## 单线程 TCP 测试
```sh
# Server
iperf3 -s -p <port>
# Client
iperf3 -c <server ip> -p <server port> -i <interval> -t <time>
```
## 多线程 TCP 测试
```sh
# Server
iperf3 -s -p <port>
# Client
iperf3 -c <server ip> -p <server port> -i <interval> -t <time> -P <parallel>
```
## 单线程 UDP 测试
```sh
# Server
iperf3 -s -p <port>
# Client
iperf3 -u -c <host> -p <port> -i <interval> -t <time>
```
## 多线程 UDP 测试
```sh
# Server
iperf3 -s -p <port>
# Client
iperf3 -u -c <host> -p <port> -i <interval> -t <time> -P <parallel>
```
## 以太网缓存
有时候 UDP 丢包率高可能是因为缓存设置参数不够优化Linux 下修改
```sh
echo 21299200 > /proc/sys/net/core/rmem_default
echo 21299200 > /proc/sys/net/core/rmem_max
```
两个文件来修改以太网缓存参数。
## 基本参数说明
| Options | Description |
|-------------|--------------------------------------------------------------------|
| -i # | Server or Client: seconds between periodic bandwidth reports |
| -p # | Server or Client: server port to listen on/connect to |
| -s | Server specific: run in server mode |
| -c \<host\> | Client specific: run in client mode, connecting to \<host\> |
| -P # | Client specific: number of parallel client streams to run |
| -t # | Client specific: time in seconds to transmit for (default 10 secs) |
| -u | Client specific: use UDP rather than TCP |