iPerf Command Line Examples

Posted on

If you want to use iPerf, of course you need to know the iPerf command line examples so that you are able to use it correctly. But, what is iPerf? Well, it is actually a command line tool which is used to diagnose network speed problems. This tool does it by measuring the maximum network throughout a server can handle.

Examples Of The iPerf Command Lines The Usage Of Them

  • Run on server:

iperf -s

  • You can run on server by using UDP mode and you have to set server port to listen on 5001:

iperf -u -s -p 5001

  • Run on client:

iperf -c server_address

  • Run on client every 2 seconds:

iperf -c server_address -i 2

  • Run on client with 5 parallel threads:

iperf -c server_address -P 5

  • Run on client using UDP mode:

iperf -u -c server_address -p 5001

If you have known the command lines, now it’s time for you to know how to use it. The easiest way that you are able to do to run iPerf is to open up a command line prompt in Windows. However, in case the command line approach cannot work for you, you are able to install JPerf 2.0.2. It is a graphical front-end for iPerf which is written in Java.

You are able to type the command below into the command line window of the server:

iPerf -s

After that, you have to hit return. That’s all. Is it very simple, right? But now, you may need the explanation of this command. Well, this command tells this instance of iPerf that it will function as a server which is waiting to get data. Then by default, the server of iPerf will listen on Port 5001 and you may need to know it in case you have to configure your firewall to map traffic for the iPerf port to the server of your iPerf. Can we use a port other than the default port? If you want to use another port other than¬† the default port, you need to specify that in the command line. If you have to use say, Port 7575 and then you have to type this command below in the command line window on the server:

iPerf -s -p 7575

After that, you have to hit return.

So, if you want to use iPerf, you have to use iperf – s command to initiate the server. Here is the start that you can do.

  • You have to type command:

iperf -s

Do you know what this command means? Well, -s means the server mode.

  • Then, to start the client, you can do that by using this command:

iperf -c 192.165.2.137 -u 100

What does this command mean?

c means the client mode.

192.165.2.137 means the IP address of the server to which client is to be connected.

u means generating the UDP packets.

100 means the length of UDP data payload.

  • After the execution of the command is successful, it will print the bandwidth and other network-related details.

If you want to test the maximum throughput achieved via UDP connection by using iPerf, you can do it as we explained below.

  • The first thing that you have to do is to start a UDP iPerf server by typing this command:

iperf -s -u

  • After that, you have to connect your client to your iPerf UDP server and you have to replace 198.51.100.5 with your IP address:

iperf -c 198.51.100.5 -u

1.05 Mbits/sec is considerably less than what was seen on the tests of TCP. Also, it is less than the maximum outbound bandwidth cap which is provided by the 1GB Linode. The reason is because iPerf limits the bandwidth for UDP clients to 1 Mbit per second by default.

  • You are able to change it with the -b flag which replaces the number after with the maximum bandwidth rate you wish to test again. In case you are testing for the speed of network, you are able to set this number above the maximum bandwidth can provided by Linode:

iperf -c 198.51.100.5 -u -b 1000m

What does this command mean? It means that it tells the client that we want to get a maximum of 1000 Mbits per second if it is possible. The -b flag only can work when utilizing the connections of UDP because iPerf does not set a bandwidth limit on the clients of TCP.

You may also want to test both servers for the maximum amount of throughout. You are able to do it by using the built-in bidirectional testing feature iPerf offers.

If you want to test both connections, you have to run the command below from the client:

iperf -c 198.51.100.5 -d

iPerf will begin a server and a client connection on the server of the client (198.51.100.6). If it has been done, then iPerf will connect the iPerf server to the client connection which is now acting as both a server connection and a client connection. Then, on the server, you will be able to see this:

Client connecting to 198.51.100.6, TCP port 5001

TCP window size: 153 KByte (default)

[ 6] local 198.51.100.5 port 58650- connected with 198.51.100.6 port 5001

[ 6]  0.0-10.1 sec 1.27 GBytes 1.08 Gbits/sec

[ 5] 0.0-10.2 sec 1.28 GBytes 1.08 Gbits/sec

Options

Here are the options and also the description of them.

  • -f

It can change the format in which the tests are run. For instance, you are able to use -f k to get results in Kbits per second instead of Mbits per second. The options which are valid are m (Mbits, default), k (Kbits), K (KBytes and M (MBytes).

  • -V

It can force iPerf to be able to use IPv6 rather than IPv4.

  • -i

It will be able to change the interval between periodic bandwidth tests. For instance, -i 60 will make a new bandwidth report every 60 seconds. The default is zero and it performs one bandwidth test.

  • -p

It will change the port. If it is not specified, the default port is 5001. You have to use this flag on both the client and server.

  • -B

It binds iPerf to a specific interface or address. If passed through the command of the server, the interface which is incoming will be set. In case passed through the command of the client, the interface which is outgoing will be set.

Leave a Reply

Your email address will not be published. Required fields are marked *