I doubt that this is a firewall issue. Usually, firewalls employ the DROP rule for packets that are not allowed. A "connection refused" means that there is no application listening on the port it tries to connect to. The destination host indicates this with a corresponding ICMP message to the source.
In order to run iperf you must have a server running on the machine which you iperf to. To do this run iperf -s on the server. After that you can then run iperf -c <server IP or hostname> -i 2
After running this you will get an ouput that looks something like this:
------------------------------------------------------------
Client connecting to <server IP>, TCP port 5000
TCP window size: 256 KByte (default)
------------------------------------------------------------
[ 3] local 123.123.123.123 port 4000 connected with 123.123.123.123 port 5000
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.1 GBytes 1.09 Gbits/sec
You also get a "connection refused" error when you use an iperf v3 client to send to an iperf v2 server.
The message is slightly different though:
As the iperf3 doc states, they are not compatible (at least up to version 3.1.2). You can check the version on both server and client with
I doubt that this is a firewall issue. Usually, firewalls employ the DROP rule for packets that are not allowed. A "connection refused" means that there is no application listening on the port it tries to connect to. The destination host indicates this with a corresponding ICMP message to the source.
In order to run iperf you must have a server running on the machine which you iperf to. To do this run
iperf -s
on the server. After that you can then runiperf -c <server IP or hostname> -i 2
After running this you will get an ouput that looks something like this:
Try turning off any firewall on the machines. On many linux distros, you can do
to disable the firewall.