Skip to content

Instantly share code, notes, and snippets.

@mrudnoru
Last active May 24, 2024 07:10
Show Gist options
  • Select an option

  • Save mrudnoru/596d156d573bd3edf95d2ee62a7ff4db to your computer and use it in GitHub Desktop.

Select an option

Save mrudnoru/596d156d573bd3edf95d2ee62a7ff4db to your computer and use it in GitHub Desktop.
Testing network bandwidth with iperf3

ipref3

Debian:

apt-get install iperf3

Dla RedHat, CentOS:

yum install iperf3

img.png

On the server side

We choose one of the servers - any. It does not matter which one will act as a server and which as a client. On the one selected as the server - after installing iperf, we do:

iperf3 -s -f K

img_1.png

By default, it will listen on port 5201 in Debian. In this case, this port should be open between the servers and unblocked. If port 5201 is closed for some reason or something else is listening on it, you can change the port with the -p (lowercase p) switch.

img_2.png

Other switches used for the test:

-s – run as server mode

-f K – format. K (Kb), M (Mb), G (Gb), T (Tb) i.e. kilobits, megabits, etc.

On the client side:

If our server is listening on the mentioned port, e.g. 6000, we issue the command on the client side:

iperf3 -c 10.0.0.3 -f K -p 6000

img_3.png

A window on the client side will appear:

img_4.png

And on the server side:

img_5.png

Network testing will begin. We have to wait until the end of the test.

img_6.png

If we switch to another switch showing e.g. Megabits per second, it will look like this:

img_7.png

As you can see, the local connection between my servers is roughly 250-320 MB/s.

In another test, the results are twice as good.

img_8.png

To maximize network utilization and test performance, for example on several simultaneous connections, we can add a switch for pararelization, i.e. simultaneous connections.

img_9.png

iperf3 -c 10.0.0.3 -f M -p 6000 -P 10

-P 10 – means 10 simultaneous connections

The marked area contains a summary of all sessions. As you can see, the network has a maximum speed of 500 Mb/s.

We can, if necessary, redirect the results to the log using the well-known > switch

iperf3 -c 10.0.0.3 -f G -p 6000 -P 10 > test.log

Then all this information displayed on the screen will be saved directly to the log file. Among other useful switches, we can, for example, return a bit more information by adding the -V or verbose switch.

img_10.png

In turn, the switches:

–4 (–version 4)

-6 (–version 6)

will determine whether we are using an ipv4 or ipv6 network.

The -D switch , in turn, will allow us to run iperf in daemon mode and close the window with the session open to the server, if we want, for example, constant, cyclical testing of the throughput of our network (e.g. from monitoring).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment