Logicalwebhost Cheatsheet

Linux & Open Source Cheatsheets & Howto's

Skip to: Content | Sidebar | Footer

iperf network testing

iperf is a strain test for networks/memory/disk, but is commonly used to find network problems. You have to install iperf as a server on some box on one end of the network, then use the iperf client on your laptop somewhere else on the network to run the throughput test. On Debian SERVER do:

cd /usr/src
apt-get install build-essential git
git clone https://github.com/esnet/iperf.git
cd iperf
./configure
make
make install
iperf3 -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
if you get an error:
iperf3: error while loading shared libraries: libiperf.so.0: cannot open shared object file: No such file or directory
you have to point to the right file:
cd /
find ./ | grep libiperf.so.0
  ./usr/src/iperf/iperf/src/.libs/libiperf.so.0.0.0
  ./usr/src/iperf/iperf/src/.libs/libiperf.so.0
  ./usr/local/lib/libiperf.so.0.0.0
  ./usr/local/lib/libiperf.so.0
echo $LD_LIBRARY_PATH
 
if you get a blank, the path does not work, so do:
LD_LIBRARY_PATH=/usr/local/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/libiperf.so.0
export LD_LIBRARY_PATH
iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

If you want these to persist across reboot edit /root/.bashrc (or wherever you want to load your variables from for this user) and add these lines to the end of the file:

vi /root/.bashrc
  LD_LIBRARY_PATH=/usr/local/lib
  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/libiperf.so.0
  export LD_LIBRARY_PATH

Now go to you LAPTOP somewhere else on the network and do:

iperf3 -c iperf.serv.er.ip -i 1 -t 10
  Connecting to host iperf.serv.er.ip, port 5201
  [  4] local you.r.i.p port 61110 connected to iperf.serv.er.ip port 5201
  [ ID] Interval           Transfer     Bandwidth
  [  4]   0.00-1.00   sec  5.64 MBytes  47.3 Mbits/sec                  
  [  4]   1.00-2.00   sec  6.45 MBytes  54.1 Mbits/sec                  
  [  4]   2.00-3.00   sec  4.79 MBytes  40.2 Mbits/sec                  
  [  4]   3.00-4.00   sec  5.40 MBytes  45.3 Mbits/sec                  
  [  4]   4.00-5.00   sec  2.31 MBytes  19.4 Mbits/sec                  
  [  4]   5.00-6.00   sec  3.89 MBytes  32.7 Mbits/sec                  
  [  4]   6.00-7.00   sec  5.11 MBytes  42.8 Mbits/sec                  
  [  4]   7.00-8.00   sec  4.22 MBytes  35.4 Mbits/sec                  
  [  4]   8.00-9.00   sec  4.90 MBytes  41.2 Mbits/sec                  
  [  4]   9.00-10.00  sec  4.11 MBytes  34.4 Mbits/sec                  
  - - - - - - - - - - - - - - - - - - - - - - - - -
  [ ID] Interval           Transfer     Bandwidth
  [  4]   0.00-10.00  sec  46.8 MBytes  39.3 Mbits/sec                  sender
  [  4]   0.00-10.00  sec  46.8 MBytes  39.3 Mbits/sec                  receiver
  iperf Done.

Write a comment

You need to login to post comments!