How to specify iperf client port

Is there a way to force the iperf client to use a specific port number as its outgoing port instead of allowing iperf to select a random port to use?

+8
source share
5 answers

In fact, none of these answers is correct: they indicate the destination port, not the client port. It seems that the client port is random (but consistent in one run), without the ability to specify it

Update 2019 : latest version option --cport to specify client port

+5
source

iperf 3 user documentation https://iperf.fr/iperf-doc.php shows that you can assign a specific client port with the parameters --cport <port> and -B --bind . Check the iperf3 user documentation for more information. The following is an example of using the 5500 client port number.

The server works with 10.0.0.2:

 > iperf3 -s 

The client works with 10.0.0.1:

 > iperf3 -c 10.0.0.2 -B 10.0.0.1 --cport 5500 
+6
source
 -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. 
Parameter

-p indicates port # to be used on the client or server. Then you need to install the same port on the server side and on the client site.

For example Server

 iperf -s -p 10000 

Client

 iperf -c SERVER_IP -p 10000 -t60 
+4
source
 iperf -c <remoteip> --port <remoteport> -B <localbindip>:<localbindport> 

I was able to do this using the above.

0
source

try: server side -

 iperf -s -i1 -fm -w512k -p1 

client side -

 iperf -c <ipadr> -i1 -fm -w512k -p1 

-p indicates the port number.

-2
source

All Articles