Linux Commands
Iperf command and usage
4 years ago + by Bamdeb Ghosh
Ipert:
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 articl
There are different versions of Iperf, we will only focus on Iperf version 2.+ only. This version
is widely used in all systems.
o
General Set up diagram:
Iperf works in server client model that means there sho
start Iperf traffic flow.Ethernet Connection
Pci ip: mar
192.168.
el 4.102]
192.168
PCL bpert
Server/Clie
nt)
Wireless Connection Stay
From the diagram we can understand that PC1 and PC: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 Ju7 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
PCI command
line
EE O% loss means all
pings are successful
Here is one screenshot for ping from PC2 to PC1168
168
pom mcsmerr)
rer]
rrr)
rer)
2. 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 Ipert Argument:
Argument
Meaning
Run server
e
Run Cl
Bandw
>Mbits? Port number (Ex: -p 5555]
w Windows size [Ex: -w 1M M->Mbits]
-d Bi-directional traffic
F Length [Ex: -| 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.
Ipert 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,
TEP client: ca
iperf -c 192.168.1.102
1-260
UDP server:UDP client:
iperf -c 192.168.1.102 -i1 -t60 -u -b 1000M
{ec}
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;
Let's try combination A
Here is the screenshot of TCP server in PC1
rt [-p]
= =a
So first we have to start server and if it's successful ther
serverCC ee eer)
Lient connecting to 192.168.1.6,| TCP port
indow size: 85.0 KByte (default
een cree ret
Bandwidth
Poe a eer
5 rseryrrcs
cone Reyne
one
PeeryNext 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.
ea
hortHere is the screenshot of UDP client in PC1.erver Listening on UDP port 7777Port
Beet Moe ier
DP buffer size: 208 KByte (default)
peace a
sets Cryer
ee ree ee)
Cee ee
Cmca
eee a
Remy
Comer Eee
reve
cae
ae
ces
1, Connect failed or connection refused:
ised
ated]
rss
raed ets
reed ets
reey eres
raed ets
raeeyerts
ree ers
ney erts
raeey eres
raed ets
raged ets
ryeey eres
rrseey eres
acclere rics
Tele Coy
Lee)
reco)
4141 (0%)
port C LO}
oy co)
ae)
4246 (11%)
7/ 3919 (0.18%)
aC)
UC
CD)
rn)
eR)
er)
ony
oy)
(ox)
(0%)
co)
rc)
der “AVG throughput 48.2MbpsHere is the screenshot
Iperf command
Error MSG
2. 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.PY eter ted
oe a tL
eror mt
Care Cae
no server report I!
PUbEy San in ssree]
fatasHere is the screenshot for Default and Customized windows size:
Interval can be increased.
Here -t 20sec and -i Ssec so we should see Iperf output at Ssec interval. Here is the
screenshot.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.ABOUT THE AUTHOR
Bamdeb Ghosh
Bamdeb Ghosh is having hands-on experience in Wireless networking
domain.He's an expert in Wireshark capture analysis on Wireless or Wired
Networking along with knowledge of Android, Bluetooth, Linux commands and
python. Follow his site: wifisharks.com
RELATED LINUX HINT POSTS.
Integrating a Linux Machine into
the Windows Active Directory
How to Configure an LDAP Client
to Use SSD
How to Get the Version of CUDA.
Installed on Linux
How to install and Enable SSH
Multi-Factor Authentication for
Wux Systems
How to Generate SSH Keys on
Windows 10/11 to Access
ux
Servers without Passwords
How to Start a Multicast Traffic in
Ipert
Iperts CommandsLinux Hint LLC, editor@linuxhint.com
1309 S Marry Ave Suite 210, Sunnyvale, CA
94087
Privacy Policy onc Terms of Use
‘ARAPTIVE PARTNER SITE
| stay |