Free Network Performance Speed Test Tools - Iperf, netperf, SCP, Wget, Curl, Speedtest - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Monday, January 25, 2021

Free Network Performance Speed Test Tools - Iperf, netperf, SCP, Wget, Curl, Speedtest

Iperf "is a commonly used network testing tool that can create TCP and UDP data streams and measure the throughput of a network that is carrying them. Iperf is a modern tool for network performance measurement written in C++."

This tool has to configure a server side and a client side to complete a test. It can test from either client side or server side, also can test from both direction. Both TCP and UDP testing is supported. Lots of options give this tool very powerful and accurate network speed testing function.


Related post:

Iperf

1. Download and Install iperf3 

The main download site is from https://iperf.fr/iperf-download.php.

Ubuntu:apt install iperf3
Centos:yum install iperf3

Windows:

https://iperf.fr/download/windows/iperf-3.1.3-win64.zip

In Linux, issue command iperf3 to run. In Windows, unzip the file and place it in a folder , run it from cmd window using administrator privilege. 

2. Start it as server

Running command 'iperf -s' from command line as iperf server (ip address 100.99.136.66).
C:\Tools>iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
[188] local 100.99.136.66 port 5001 connected with 100.94.200.14 port 48410
[ ID] Interval       Transfer     Bandwidth
[188]  0.0-10.0 sec   121 MBytes   101 Mbits/sec

Server Mode:iperf3 -s -p <port number>


3. Run iperf as test client
Client Mode:iperf3 -c <Server IP> -p <Server Port> -t <Test time, second> -P <Parallel stream numbers> -R <Test From Server to Client(Download), with -R, testing is from Client to Server(Uplod)>

User 'ipef -c' command to run from client test machine (ip adss 100.94.200.14)  to evaluate the network throughput based on TCP connection.

C:\tools>iperf -c 100.99.136.66
------------------------------------------------------------
Client connecting to 100.99.136.66, TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
[1912] local 100.94.200.14 port 48410 connected with 100.99.136.66 port 5001
[ ID] Interval       Transfer     Bandwidth
[1912]  0.0-10.0 sec   121 MBytes   101 Mbits/sec

4. Send 100MBytes data for testing


iperf -c 100.99.136.66 -n 100m

5. Bi-direction test

Simultaneous bi-directional bandwidth measurement: (-d argument)
To measure the bi-directional bandwidths simultaneousely, use the -d argument. If you want to test the bandwidths sequentially, use the -r argument (see previous test).
By default (ie: without the -r or -d arguments), only the bandwidth from the client to the server is measured.

C:\tools> iperf -c 100.99.136.66  -d
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to 10.1.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[ 5] local 10.6.2.5 port 60270 connected with 10.1.1.1 port 5001
[ 4] local 10.6.2.5 port 5001 connected with 10.1.1.1 port 2643
[ 4] 0.0-10.0 sec 76.3 MBytes 63.9 Mbits/sec
[ 5] 0.0-10.1 sec 1.55 MBytes 1.29 Mbits/sec

6. Parallel TCP connections

Parallel connections can be useful if you need to saturate the bandwidth of a link.  The bandwidth of a single TCP session can be greatly affected by the size of the receive window and the latency of the link.
iperf -s -i 1 (-i 1 means update terminal every second)
iperf -c 192.168.1.1 -t 30 -P 10
Add caption
7.  Other Parameters
iperf -c 12.12.12.12 -p 2233 -i 1 -t 60 -f M
Notes:
c:start iperf as client, followed ip address is remote server ip.
p:set specific server port, which should be same as server side's settings.
i:reporting intervals
t:length of test
f:change number output format
Other parameters can be found from https://iperf.fr/iperf-doc.php.

iperf3 --help


C:\temp\iperf-3.1.3-win64>iperf3 --h
Usage: iperf [-s|-c host] [options]
       iperf [-h|--help] [-v|--version]

Server or Client:
  -p, --port      #         server port to listen on/connect to
  -f, --format    [kmgKMG]  format to report: Kbits, Mbits, KBytes, MBytes
  -i, --interval  #         seconds between periodic bandwidth reports
  -F, --file name           xmit/recv the specified file
  -B, --bind      <host>    bind to a specific interface
  -V, --verbose             more detailed output
  -J, --json                output in JSON format
  --logfile f               send output to a log file
  -d, --debug               emit debugging output
  -v, --version             show version information and quit
  -h, --help                show this message and quit
Server specific:
  -s, --server              run in server mode
  -D, --daemon              run the server as a daemon
  -I, --pidfile file        write PID file
  -1, --one-off             handle one client connection then exit
Client specific:
  -c, --client    <host>    run in client mode, connecting to <host>
  -u, --udp                 use UDP rather than TCP
  -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
                            (default 1 Mbit/sec for UDP, unlimited for TCP)
                            (optional slash and packet count for burst mode)
  -t, --time      #         time in seconds to transmit for (default 10 secs)
  -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)
  -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)
  -l, --len       #[KMG]    length of buffer to read or write
                            (default 128 KB for TCP, 8 KB for UDP)
  --cport         <port>    bind to a specific client port (TCP and UDP, default: ephemeral port)
  -P, --parallel  #         number of parallel client streams to run
  -R, --reverse             run in reverse mode (server sends, client receives)
  -w, --window    #[KMG]    set window size / socket buffer size
  -M, --set-mss   #         set TCP/SCTP maximum segment size (MTU - 40 bytes)
  -N, --no-delay            set TCP/SCTP no delay, disabling Nagle's Algorithm
  -4, --version4            only use IPv4
  -6, --version6            only use IPv6
  -S, --tos N               set the IP 'type of service'
  -Z, --zerocopy            use a 'zero copy' method of sending data
  -O, --omit N              omit the first n seconds
  -T, --title str           prefix every output line with this string
  --get-server-output       get results from server
  --udp-counters-64bit      use 64-bit counters in UDP test packets

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

iperf3 homepage at: http://software.es.net/iperf/
Report bugs to:     https://github.com/esnet/iperf

C:\temp\iperf-3.1.3-win64>
YouTube Video:


NetPerf


NetPerf for example provides tests for end-to-end latency (round-trip times or RTT) and is a good replacement for Ping, iPerf provides packet loss and delay jitter, useful to troubleshoot network performance.

NetPerf common parameters

  • -p (–port): Port number (12865 by default)
  • -H (–host): Host/Server IP address or DNS name
  • -t (–testname): Specifies test to perform (TCP_STREAM by default)
  • -l (–testlen): Specifies test duration in seconds (>0 secs)
  • -m value set the local send size to value bytes. [Default: local socket buffer size]
  • -M value set the remove receive size to value bytes. [Default: remote receive socket buffer size]

For more information use: $ netperf -h

$ netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC

$ netperf -H 172.31.56.48 -l 300 -t TCP_STREAM

$ netperf -H 172.31.56.48 -t UDP_STREAM -l 300 -- -R 1 -m 1024


netperf相比iperf功能更加丰富,通常用来测试虚拟网卡收包性能。

iperf相比netperf功能相对专一,但是其原生支持多线程,通常用来测试虚拟网卡的吞吐(带宽)。


Using SCP to Test


Generating 1GB test file using DD command

[root@MachineA ~]# dd bs=1024K count=1024 if=/dev/random of=test1000m.bin
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 5.69383 s, 199 MB/s

SCP to copy remote machine's file. 


[root@MachineB ~]# scp root@MachineA:~/test1000m.bin .
test1000m.bin 14% 144MB 13.2MB/s 01:06 ETA

Optional command to use time command:



[root@MachineB ~]# time scp root@MachineA:~/test1000m.bin .


Using wget / curl


Start a SimpleHTTPServer module:

python -m SimpleHTTPServer
# python3 , you can use http.server module
python3 -m http.server


[root@MachineB ~]# wget http://MachineA:8000/test1000m.bin
--2020-12-23 02:01:19-- http://MachineA:8000/test1000m.bin
Resolving MachineA (MachineA)... xxx.xxx.xx.xx
Connecting to MachineA (MachineA)|xxx.xxx.xx.xx|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1073741824 (1.0G) [application/octet-stream]
Saving to: ‘test1000m.bin’

test1000m.bin 68%[======================> ] 696.59M 10.3MB/s eta 32s


Using speedtest cli command


Install python 3 or python 2, then download speedtest-cli test python script to execute test from command line. 


$ sudo yum install python3
$ sudo yum install python2

$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
$ chmod +x speedtest-cli

$ ./speedtest-cli

$ python speedtest-cli








No comments:

Post a Comment