Is it possible to check bandwidth using iperf between two computers on different networks(i.e geographically apart)?. I researched a lot and every answer on stack exchanges or any other website tutorials only talk about on same networks using private ip addr.
iperf.fr have public servers but I'm not able to create using iperf -s. Is firewall blocking server to work using public addresses or Internet Services Providers doesn't allow to avoid attacking?
For me it is not working on any operating system,
In linux 20.04, iperf -s
private ip add: 192.xx.xx.xx
public ip add: 223.xx.xx.xx When I call iperf -c <ip add> from another linux machine
If public ip add : same as upper , works fine
On different ip add I'm getting
iperf3: error - unable to connect to server: Connection timed out error.

  • "Is firewall blocking server to work using public addresses or Internet Services Providers doesn't allow to avoid attacking?" You have not provided any network design, network device models, network device configurations, etc. that are necessary to be able to answer your question. As asked, we could only guess or speculate, and that is off-topic here. Please add enough information for use to be able to help you.
    – Ron Maupin
    Jan 27 '21 at 13:53
  • Host/server problems are off-topic here. We could try to help with the network, but we need a good network description or diagram, the network device models, and the network device configurations.
    – Ron Maupin
    Jan 27 '21 at 18:56

Yes that's possible, provided...

  • both involved computers run iperf, one in "server mode", one in "client" mode.
  • the required TCP (and optionally UDP) communication between "client" and "server" can be established, in the desired direction of initiator -> responder

For b), iPerf 1.7.x and 2.0.x use port 5001 by default, iPerf3.x.x use port 5201. Both version families allow to modify/change the port with the -p command line parameter.

And yes of course, depending on your network environment, some ports might be blocked by firewalls. The port you set on the "server" end must be reachable from the "client".

Also, you might not be able to run iperf3 -s -p <port> at all on the computer to be used as the server, as setting up sockets in LISTENING mode might not be allowed without elevated privileges - something to ask your sysadmin about.

iPerf and data transfer direction

Depending on test scenario (especially when testing UDP), the more interesting output is generated at the receiver's end.

Since the "server" is usually the receiver, having CLI access to the server side is beneficial. iPerf3 offers a bit more comfort here, by using the --get-server-output command line option from the client.

Be aware that iPerf has the notions of "server" and "client" somewhat reversed, compared to what is commonly done in client/server environments:

  • the "client" is usually the sender and initiates the connection
  • the "server" is usually the receiver and responds to the connection request

However: Data transfer direction (i.e. sender and receiver roles) can be swapped by using the -R command line switch from the client side.

Why only same subnet in FAQs?

I think most examples/guides you find on the Internet use private adressing and happen within the same subnet, because that's what novices will a) encounter first and b) mostly will involve only "switching" by the network components between sender and receiver. In these days, even simple switches can achieve full line rate at 1Gbps and results will more likely meet a novice's expectations.

Once the users start to run iPerf across routing boundaries, a whole different set of networking components (routers, firewalls, high latency links, lossy links) with different performance characteristics (forwarding rate, buffering, load-sharing) come into play, most of which are far beyond the sphere-of-influence of the novice iPerf users themselves. The questions arising will be a lot more complex and finding the answers will require knowlegde about the network path being used between sender and receiver, or the ability to acquire that knowledge (in extenso: ask the network admin...).

That being said, iPerf can be a woderful tool to measure and baseline a networks capabilities and performance, but to understand the results, you have to understand the network topology which is under test.

  • (Quoting myself) the required TCP (and optionally UDP) communication between "client" and "server" can be established. Talk to your sysadmin, to the network admin, your firewall admin (both on client side and server side) to find out if and what migh be blocking that connection. Use alternative ports if iPerf's default ports are not allowed. Jan 27 '21 at 9:01