Lewati ke isi

iperf

iperf is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, protocols, and buffers. For each test it reports the measured throughput / bitrate, loss, and other parameters.

This version, sometimes referred to as iperf3, is a redesign of an original version developed at NLANR/DAST. iperf3 is a new implementation from scratch, with the goal of a smaller, simpler code base, and a library version of the functionality that can be used in other programs. iperf3 also has a number of features found in other tools such as nuttcp and netperf, but were missing from the original iperf. These include, for example, a zero-copy mode and optional JSON output. Note that iperf3 is not backwards compatible with the original iperf.

Primary development for iperf3 takes place on Ubuntu Linux, FreeBSD, and macOS. At this time, these are the only officially supported platforms, however there have been some reports of success with OpenBSD, NetBSD, Android, Solaris, and other Linux distributions.

iperf3 is principally developed by ESnet / Lawrence Berkeley National Laboratory. It is released under a three-clause BSD license.

How to Install and Use iPerf3 on Ubuntu

  • Using Apt Command

Before installing iPerf3 , please update the system by the following command:

sudo apt update
sudo apt install iperf3
iperf3 -v

How to Use iPerf3 in Ubuntu

Start iPerf3 on Server First, you need to identify that your Ubuntu host can act as an iperf3 server using the following command.

img

If you see in the output that the iPerf3 server is listening to a specific port, it means that the iPerf3 server works as expected.

By default, the iPerf3 server will listen to all active interfaces of the host for new connections. You can use the below command to ensure that the iPerf3 server only listens on some specific interface

iperf3 -s -B <ip-address>

From the above output, you can see that iPerf3 only listens on port 5201. However, you can also use a different port than the default one. You need to run the following command with that specific port number.

iperf3 -s -p <port number>

Start iPerf3 on the Client Similarly, you need to identify that your Ubuntu host can act as an iPerf3 client using the following command.

iperf3 -c <server-ip-address>

After running the above command, you can see that the client needs to connect with the server, whose IP address is shown in the above output.

You can check from the output that the iPerf3 server successfully accepted a connection from an iPerf3 client. Now the server will exchange all the data with the client.

Note that you will see the exact output when an iPerf3 client targets some specific iperf3 server.

If you use some specific port number other than the default, you also need to specify that port number.

Iperf3 -c <server IP address> -p <port number>

You can reverse the direction of packets using the following command:

iperf3 - c <IP address of the server> - R

At UDP Protocol Servers & Clients By default, iPerf3 measures the TCP protocol for network performance testing. For UDP performance testing, you always need to use ‘-u.’ First, start the UDP iPerf3 server by running the below command.

iperf3 -s -u

Now you can connect your iPerf3 server with your client using the following command.

iperf3 -c <server IP address> -u

If you want the best network bandwidth in the UDP testing results, you can increase the sending bandwidth using the option “-b value.” Here, ‘value’ indicates the bandwidth by which you want to increase.

iperf3 -c -u <Server IP Address> -b value

Measuring the MTU (Maximum Transfer Size) You can easily check the maximum transfer size by using the below command.

iperf3 -mc <server IP address>

Here, the -m option instructs iPerf3 to show the MTU.

Measure Downstream and Upstream Throughput If you want to check the downstream and upstream throughput, use the ‘-bidir’ option with the above command.

iperf3 -c <server IP address> -bidir

For a specific port, run the following command.

Iperf3 -c <server IP address> -p <port number> -bidir

Bidirectional Test Using iPerf3 Sometimes you may need to check the maximum throughput of both servers. You can do this easily using the bidirectional testing feature, which is pre-built-in offered by iPerf. You can test the connection from both sides by running the below command:

iperf3 -c <server IP address> -d

After executing the above command, iperf3 connects the iPerf3 server to the client. It acts as both a client connection and a server connection.

How to Uninstall iPerf3 in Ubuntu For some reason, you may need to remove iPerf3 or no longer have it in your system. Therefore, uninstalling it is just as easy as installing it.

To uninstall only the iPerf3 package, use the following command.

sudo apt-get remove iperf3

Please run the following command to remove iPerf3 with dependencies, data, and configuration completely.