[Network](EN) Measure network performance between two computers using iperf3

Measure network performance using iperf3


Environment and Prerequisite

  • Linux base system
  • Bash shell(/bin/bash)
  • Concept of NIC device, switch and subnet
  • Basic usage of ip command


iperf3 command

What is iperf3?

iperf3 -s [ options ]
iperf3 -c server [ options ]
  • iperf3: Measure network performance of two computers.
  • There are also iperf2 and iperf.


Installation

  • CentOS
sudo yum install iperf3 -y
  • Ubuntu
sudo apt-get install iperf3 -y


Usage

  • In two computers, decide one is server and the other is client. After decide each of it, run each command like below.
  • Port should be opened in each computer.
  • iperf3 use 5201 port.

Server

  • Use below command
iperf3 -s

Client

  • Use below command
  • Put IP address of server to IP ADDRESS which you want to measure performance. Put above iperf3 running server’s IP.
iperf3 -c [IP ADDRESS]


Example

Computer network information

  • Server
$ ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:3e:6c:4f:da:2b brd ff:ff:ff:ff:ff:ff
    inet 10.136.105.252/16 brd 10.136.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::503e:6cff:fe4f:da2b/64 scope link
       valid_lft forever preferred_lft forever
  • Client
$ ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 9e:79:07:2a:26:e3 brd ff:ff:ff:ff:ff:ff
    inet 10.136.107.214/16 brd 10.136.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::9c79:7ff:fe2a:26e3/64 scope link
       valid_lft forever preferred_lft forever

Run in server

# Update package list
$ sudo apt-get update -y

# Install package
$ sudo apt-get install iperf3 -y

# Run iperf3 server
$ iperf3 -s

Run in client

# Update package list
$ sudo apt-get update -y

# Install package
$ sudo apt-get install iperf3 -y

# Run iperf3 server
$ iperf3 -c 10.136.105.252

Result

  • Server
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.136.107.214, port 36216
[  5] local 10.136.105.252 port 5201 connected to 10.136.107.214 port 36218
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec   251 MBytes  2.11 Gbits/sec
[  5]   1.00-2.00   sec   238 MBytes  1.99 Gbits/sec
[  5]   2.00-3.00   sec   236 MBytes  1.98 Gbits/sec
[  5]   3.00-4.00   sec   236 MBytes  1.98 Gbits/sec
[  5]   4.00-5.00   sec   241 MBytes  2.02 Gbits/sec
[  5]   5.00-6.00   sec   237 MBytes  1.99 Gbits/sec
[  5]   6.00-7.00   sec   236 MBytes  1.98 Gbits/sec
[  5]   7.00-8.00   sec   242 MBytes  2.03 Gbits/sec
[  5]   8.00-9.00   sec   238 MBytes  2.00 Gbits/sec
[  5]   9.00-10.00  sec   237 MBytes  1.99 Gbits/sec
[  5]  10.00-10.04  sec  10.2 MBytes  2.07 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.04  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.04  sec  2.35 GBytes  2.01 Gbits/sec                  receiver
  • Client
Connecting to host 10.136.105.252, port 5201
[  4] local 10.136.107.214 port 36218 connected to 10.136.105.252 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   262 MBytes  2.20 Gbits/sec  16168   97.6 KBytes
[  4]   1.00-2.00   sec   239 MBytes  2.00 Gbits/sec  16140    451 KBytes
[  4]   2.00-3.00   sec   240 MBytes  2.01 Gbits/sec  13883    136 KBytes
[  4]   3.00-4.00   sec   238 MBytes  2.00 Gbits/sec  11752    365 KBytes
[  4]   4.00-5.00   sec   238 MBytes  2.00 Gbits/sec  18333    297 KBytes
[  4]   5.00-6.00   sec   238 MBytes  1.99 Gbits/sec  19573    122 KBytes
[  4]   6.00-7.00   sec   238 MBytes  1.99 Gbits/sec  18483    115 KBytes
[  4]   7.00-8.00   sec   234 MBytes  1.96 Gbits/sec  17792    229 KBytes
[  4]   8.00-9.00   sec   241 MBytes  2.02 Gbits/sec  15119   1.20 MBytes
[  4]   9.00-10.00  sec   239 MBytes  2.00 Gbits/sec  23006   93.3 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  2.35 GBytes  2.02 Gbits/sec  170249             sender
[  4]   0.00-10.00  sec  2.35 GBytes  2.01 Gbits/sec                  receiver

iperf Done.


Reference