Installing iperf on CentOS

I ran yum install iperf to install the network bandwidth test tool Iperf on a CentOS 7 system, but was informed "No package iperf available."
# yum install iperf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
No package iperf available.
Error: Nothing to do
[root@localhost install]#

When I checked the package repositories that were in use on another system that had iperf installed by using the command yum repolist, I found the following:

Save on a Computer: Run Windows, Mac, and Linux with VirtualBox
Save on a Computer: Run Windows,
Mac, and Linux with VirtualBox
1x1 px

# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.us.leaseweb.net
 * epel: mirror.cogentco.com
 * extras: mirror.umd.edu
 * updates: centos.firehosted.com
repo id               repo name                                           status
!base/7/x86_64        CentOS-7 - Base                                     8,652
!epel/x86_64          Extra Packages for Enterprise Linux 7 - x86_64      8,653
!extras/7/x86_64      CentOS-7 - Extras                                     216
!updates/7/x86_64     CentOS-7 - Updates                                  1,512
repolist: 19,033

When I checked the repository that had been used for the installation of Iperf on that other system, I saw it was the epel repository.

oreilly.com - Your tech ebook super store
# yum provides iperf
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.us.leaseweb.net
 * epel: mirror.cogentco.com
 * extras: mirror.umd.edu
 * updates: mirrors.tripadvisor.com
iperf-2.0.8-1.el7.x86_64 : Measurement tool for TCP/UDP bandwidth performance
Repo        : epel



iperf-2.0.8-1.el7.x86_64 : Measurement tool for TCP/UDP bandwidth performance
Repo        : @epel

You can use yum provides pkgname or yum whatprovides pkgname to see package information for pkgname and also the repository from which the package was obtained.

When I checked the repositories in use on the system where yum install iperf did not install iperf, I found it had only the default repositories and did not have the epel repository.

[root@localhost install]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
repo id                             repo name                             status
base/7/x86_64                       CentOS-7 - Base                       8,652
extras/7/x86_64                     CentOS-7 - Extras                       236
updates/7/x86_64                    CentOS-7 - Updates                    1,531
repolist: 10,419
[root@localhost install]#

The Extra Packages for Enterprise Linux (EPEL) is a "community approved" repository, which is listed on the CentOS wiki under Available Repositories for Linux, which notes that though community repositories are not associated with the CentOS project, that "These repositories are frequently recommended by the community, are usually well maintained, and provide a substantial number of additional packages to CentOS." The wiki also notes:

Extra Packages for Enterprise Linux (EPEL) - (See http://fedoraproject.org/wiki/EPEL) provides rebuilds of Fedora packages for EL5, EL6 and EL7. Packages should not replace base, although there have been issues around point releases in the past. You can install EPEL by running yum install epel-release. The epel-release package is included in the CentOS Extras repository that is enabled by default. Support available on Freenode in #epel, on mailing lists, and its issue tracker.

On the system where the EPEL repo was in use, I found the following in /etc/yum.repos.d:

# ls /etc/yum.repos.d
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Sources.repo  epel.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Vault.repo    epel-testing.repo

The system where the EPEL repository wasn't used had only the following files in the same directory:

[root@localhost install]# ls /etc/yum.repos.d
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Sources.repo  CentOS-Vault.repo

I installed the EPEL repository on that system with yum install epel-release. I was then able to install iperf on that system with yum install iperf and was then able to run iperf in server mode on the system.

# iperf -s &
[1] 22474
[root@localhost install]# ------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

[root@localhost install]#

I ran iperf -c 192.168.18.44 on another system to use iperf on the other system in client mode to test the bandwidth between the two systems. On the server end, i.e., the system where I just installed iperf and ran the iperf -s command, I saw the following:

[root@localhost install]# [  4] local 192.168.18.44 port 5001 connected with 172.25.2.72 port 55990
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.4 sec  3.00 MBytes  2.42 Mbits/sec

You may have to create a firewall rule on the system functioning as an iperf server. For CentOS 7 systems, the default firewall software is firewalld. The default port used by iperf is 5001, so you will need to open that port in the firewall for both UDP and TCP, if you wish to use both protocols.

References:

  1. Available Repositories
    Last edited: 2015-10-02 CentOS - Community ENTerprise Operating System