DEV Community

Cover image for iPerf Essentials: Turbocharge Your Network with Command-Line Mastery
Mihika
Mihika

Posted on

iPerf Essentials: Turbocharge Your Network with Command-Line Mastery

Introduction to iPerf

iPerf stands as a command-line utility utilized for testing network performance between two devices. The process involves running iPerf in server mode on one system and in client mode on another. This guide will walk through the steps for executing this, including an option for testing on a single system when two separate computers are not available. The focus of this exploration is network performance testing using iPerf in Kali Linux, enabling users of this operating system to follow along seamlessly.

The Relevance of iPerf in Organizational Networks

In instances where users or administrators encounter sluggish network performance or unanticipated behavior, iPerf proves invaluable for diagnosing and pinpointing potential bottlenecks. By conducting tests between two devices, iPerf aids in identifying the exact location of performance issues within the network.

Essential Terminology

Before delving into iPerf commands, it is essential to clarify a few fundamental terms:

Bandwidth: The maximum capacity of a communication channel, denoting the potential data transmission volume within a specified timeframe, measured in bits per second (bps), kilobits per second (Kbps), megabits per second (Mbps), or gigabits per second (Gbps).

Bit Rate: The speed of data transfer.

Throughput: The actual amount of data transferred over a network in specific periods, potentially measured in megabits or gigabits per second. Actual throughput may be lower than the network bandwidth due to factors such as network congestion, protocol overhead, and other real-world transmission inefficiencies.

Latency: The round-trip time for data to travel from source to destination and back.
Jitter: The variation in latency over time.

Multithreaded Testing: iPerf supports simultaneous testing with multiple threads, where a thread represents a smaller unit of a process run independently within a program.

UDP and TCP Testing: iPerf measures both TCP and UDP performance, including SCTP.

Server-Client Model: iPerf operates within a client-server architecture, with one system serving as the server and the other as the client.

iPerf Commands

Installing iPerf on Kali Linux:
Open a terminal window and execute the following commands:
sudo apt update
sudo apt install iperf3

Setting Up Client-Server Architecture:

For two computers, run iPerf in server mode on one system and in client mode on the other. For a single computer, open two terminal windows and follow along. Testing network performance on the same machine may not provide realistic results for real-world network scenarios. iperf is more commonly used to test the network between two separate devices.
Nevertheless, if you want to familiarize yourself with iperf and understand its usage, running it locally on a single machine is a good way to get started.

On one system, Execute the command(server mode) : iperf3 -s
on another for client mode: iperf3 -c server_ip

Setting Up Client-Server Architecture

Customizing Test Duration:

Adjust the test duration using the -t option. In this example, a 10-second test is executed, with results displayed every 2 seconds using the -i option.

Customizing Test Duration

UDP testing:

iPerf supports UDP testing with the -u flag.

UDP testing

Bidirectional testing:
bidirectional testing refers to the process of testing communication in both directions between two devices or systems.
Check upload and download speeds by using the -t flag, -R flag in iperf3 allows for bidirectional testing, measuring both download and upload speeds. Instead of receiving data from the server (upload), the client actively sends data to the server (download).

Bidirectional testing

Consider using tools like speedtest-cli for measuring internet speed, providing more user-friendly output.

speedtest-cli Installation

Parallel Testing:

Utilize the -P flag to instruct iPerf to use multiple parallel processes (in this case, 5) for the test. This facilitates simultaneous data streams, potentially achieving higher throughput compared to a single process.

Parallel Testing

Using Specific Port:

Specify a port using the -p flag.

Using Specific Port

Changing Window Size and Buffer Size:

Use the -w flag to set the TCP window size, defining the amount of data the sender advertises to the receiver. The -l flag sets the buffer size for reading and writing data during the test.
When utilizing the iperf3 command, you will observe a column labeled 'cwnd.' This represents the Congestion Window, which indicates the current amount of data a sender is willing to transmit before receiving an acknowledgment.

Changing Window Size and Buffer Size

Changing MSS and Saving Output:

Alter the Maximum Segment Size (MSS) using the -M flag and save the output using the --logfile option

Changing MSS and Saving Output

Testing Specific Bandwidth Range:

Explore specific bandwidth ranges using the -b flag.

Testing Specific Bandwidth Range

The exploration of iPerf commands does not conclude here; numerous other options can be uncovered using the command:
iperf3 -h

In conclusion, mastering iPerf commands opens the door to a comprehensive understanding of network performance testing, empowering users to optimize their networks effectively.

Top comments (0)