How to specify iperf client port

mirandaio picture mirandaio · Apr 8, 2012 · Viewed 35.4k times · Source

Is there a way to force an iperf client to use a specific port number as its outgoing port instead of letting iperf on choosing a random port to use?

Answer

talpur99 picture talpur99 · Aug 5, 2016

iperf 3 user documentation https://iperf.fr/iperf-doc.php reveals you can assign a specific client port with --cport <port> and -B --bind option. Check iperf3 user documentation for further details. Here is an example of using client's port number 5500.

Server runs on 10.0.0.2:

> iperf3 -s 

Client runs on 10.0.0.1:

> iperf3 -c 10.0.0.2 -B 10.0.0.1 --cport 5500