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

66 lines
2.2 KiB
Markdown
Raw Normal View History

# IPerf 使用说明
IPerf 可用于网络带宽测试,可在 Windows、Linux、Android、MacOS 和 iOS 系统下运行。主要有 IPerf2 和 IPerf3 两大版本。
IPerf 可做为 Server 端或 Client 端运行Client 发起与 Server 端的通讯,并对通讯性能进行分析。
## 单线程 TCP 测试
```bash
# Server
iperf3 -s -p <port>
# Client
iperf3 -c <server ip> -p <server port> -i <interval> -t <time>
```
## 多线程 TCP 测试
```bash
# Server
iperf3 -s -p <port>
# Client
iperf3 -c <server ip> -p <server port> -i <interval> -t <time> -P <parallel>
```
## 单线程 UDP 测试
```bash
# Server
iperf3 -s -p <port>
# Client
iperf3 -u -c <host> -p <port> -i <interval> -t <time>
```
## 多线程 UDP 测试
```bash
# Server
iperf3 -s -p <port>
# Client
iperf3 -u -c <host> -p <port> -i <interval> -t <time> -P <parallel>
```
## 以太网缓存
有时候 UDP 丢包率高可能是因为缓存设置参数不够优化Linux 下修改
```bash
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 |
| -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) |