Iperf command and usage

29/12/2020
Chưa phân loại

Iperf:

Iperf is an open source networking tool used to measure throughput or performance of a network. It can be used to test TCP and UDP. Iperf can be used in Windows, Linux, and MAC etc operation system.

Intention of this article:

There are different versions of Iperf, we will only focus on Iperf version 2.+ only. This version is widely used in all systems.

General Set up diagram:

Iperf works in server client model that means there should be one server and one client to start Iperf traffic flow.

Wireless Connection

From the diagram we can understand that PC1 and PC2 should have valid IP address.

Connection between two PCs can be wired or wireless.

Actual Set up:

  1. In our experiment PC1 is windows and PC2 is Linux.
  2. PC1 IP is 192.168.1.6 and PC2 is 192.168.0.102
  3. PC1 iperf version

Command:

iperf –version
iperf version 2.0.5 (08 Jul 2010) pthreads

4. PC2 iperf version

Command:

iperf –version
iperf version 2.0.5 (08 Jul 2010) pthreads

Iperf Conditions:

There are some conditions before Iperf to work.

  1. PC1 should ping to PC2 and vice versa. We can use ping 192.168.1.102 from PC1 console or command line to see if PC1 is able to reach PC2. Do ping from PC2 to PC1 to check the reachbility of PC1 from PC3.

Here is one screenshot for ping from PC1 to PC2

Here is one screenshot for ping from PC2 to PC1

  1. Both PCs should Iperf binary. It’s better to keep same version of Iperf or close versions. But remember Iperf 2.0 does not work with Iperf 3.0.

Note: UDP does not establish any UDP connection before transferring data and UDP does not need any ACK from other side. So even if IPERF server is not running client will able send data unlike TCP. So always check in server side for UDP data.

Important Iperf Arguments:

Argument Meaning
-s Run server
-c Run Client [Ex: -c 192.168.1.102]
-u UDP
-b Bandwidth [Used in UDP, Ex: 100M M->Mbits]
-i Output interval in Sec [Ex: -i1 1sec interval]
-t Time in sec [Ex: -t60 60sec]
-p Port number [Ex: -p 5555]
-w Windows size [Ex: -w 1M M->Mbits]
-d Bi-directional traffic
-l Length [Ex: -l 1046 1046bytes]
-V Used when IPv6 address is used instead of IPv4

There are other arguments but not used in general. We can use man iperf command in Linux to get all arguments.

Iperf commands:

There are many arguments for Iperf command, we will discuss on only important and useful arguments. Below are minimum arguments which can be used to run iperf.

TCP server:

iperf –s –i1

TCP client:

iperf –c 192.168.1.102 –i1 –t60

UDP server:

iperf –s –i1 -u

UDP client:
iperf –c 192.168.1.102 –i1 –t60 –u –b 1000M
[/cc]

Start Iperf:

Now we have PC1 and PC2 so below combinations can be run between these two PCs.

  1. TCP server in PC1 and TCP client PC2
  2. TCP client in PC1 and TCP server PC2
  3. UDP server in PC1 and UDP client PC2
  4. UDP client in PC1 and UDP server PC2

Experiment 1:

Let’s try combination A

Here is the screenshot of TCP server in PC1.

So first we have to start server and if it’s successful then it will be in listing mode.

Here is the screenshot of TCP client in PC2.

Here is the screenshot for TCP server side

Next if we want to try combination B, then we just need to run TCP server in PC2 and TCP client in PC1.

Experiment 2:

Let’s try combination D.

Here is the screenshot of UDP server in PC2.

So first we have to start server and if it’s successful then it will be in listing mode.

Here is the screenshot of UDP client in PC1.

Here is the screenshot of UDP server output in PC2

Known Errors:

  1. Connect failed or connection refused:

When we run TCP client without TCP server this error occurs.

Here is the screenshot

  1. UDP without server:

When we run UDP client without server, we can identify this with some observations

  1. After UDP client throughput is completed, we should not any server report for average. Check the point B in below screenshot.
  2. Throughput may be higher than the connected bandwidth. Check the point A in below screenshot.
  3. Here is the expected UDP client screenshot

Some experiemnt argument:

-w:

Window size can be increased.

Here is the screenshot for Default and Customized windows size:

-i:

Interval can be increased.

Here –t 20sec and –i 5sec so we should see Iperf output at 5sec interval. Here is the screenshot.

Summary:

To measure any performance in Wired or Wireless network Iperf is the basic requirement. As it’s an open source so can used without any license. Iperf gives quite accurate results with comparison to license tool like IxChariot.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Linux Mint Boot Repair

If the boot configuration is corrupted, the OS won’t boot properly. While it’s not common to run into boot problems,...
29/12/2020

ZSH – Pretty, what else is great about it

Zsh is touted as a great alternative to bash and all other shells. The shell has many of the features, if not all of bash...
29/12/2020

Java 11 New Features

Oracle has recently released Java Development Kit 10 (JDK 10), and that means JDK 11 is not far away, in accordance with...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024