如何指定iperf客户端端口

mir*_*aio 9 port client

有没有办法强制iperf客户端使用特定的端口号作为其传出端口,而不是让iperf选择使用的随机端口?

小智 7

-p, --port #    $IPERF_PORT The server port for the server to listen on and the client to connect to. This should be the same in both client and server. Default is 5001, the same as ttcp.
Run Code Online (Sandbox Code Playgroud)

-p 选项表示要在客户端或服务器中使用的端口号。然后您需要为服务器端和客户端站点设置相同的端口。

例如服务器

iperf -s -p 10000
Run Code Online (Sandbox Code Playgroud)

客户

iperf -c SERVER_IP -p 10000 -t60
Run Code Online (Sandbox Code Playgroud)

  • -p 选项仅指定服务器的端口。 (2认同)

小智 7

iperf 3用户文档https://iperf.fr/iperf-doc.php显示您可以使用--cport <port>-B --bind选项分配特定的客户端端口.查看iperf3用户文档以获取更多详细信息.以下是使用客户端端口号5500的示例.

服务器在10.0.0.2上运行:

> iperf3 -s 
Run Code Online (Sandbox Code Playgroud)

客户端在10.0.0.1上运行:

> iperf3 -c 10.0.0.2 -B 10.0.0.1 --cport 5500
Run Code Online (Sandbox Code Playgroud)


Fra*_*ers 6

实际上这些答案都不正确:它们指定目标端口,而不是客户端端口.似乎客户端端口是随机的(但在一次运行中是一致的),没有办法指定它