Difference between revisions of "Internet speed test using Terminal"

From Ever changing code
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Speedtest.net =
= Speedtest.net =
<source lang=bash>
  sudo apt-get install python-pip
  sudo apt-get install python-pip
  pip install speedtest-cli
  pip install speedtest-cli
</source>
or:
or:
<source lang=bash>
  sudo apt-get install python-setuptools
  sudo apt-get install python-setuptools
  easy_install speedtest-cli
  sudo easy_install speedtest-cli
</source>
This 2nd solution worked on AWS Ubuntu 13.04 Server and it needed ~3Mb (<tt>python-setuptools</tt>) to download versus ~80Mb for <tt>python-pip</tt>


This 2nd solution worked on AWS Ubuntu 13.04 Server and it needed ~3Mb (<tt>python-setuptools</tt>) to download versus ~80Mb for <tt>python-pip</tt>
Run the speedtest:
<source lang=bash>
$ speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Global Crossing (217.156.150.69)...
Selecting best server based on latency...
Hosted by Gigaclear PLC (Slough) [8.91 km]: 13.461 ms
Testing download speed........................................
Download: 23.93 Mbit/s
Testing upload speed..................................................
Upload: 12.27 Mbit/s
</source>


= Wget =
= Wget =
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
wget -O /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip
curl -o /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip
wget -O /dev/null http://ipv4.download.thinkbroadband.com/1GB.zip
wget -O /dev/null http://ipv4.download.thinkbroadband.com:81/1GB.zip
wget -O /dev/null http://ipv4.download.thinkbroadband.com:8080/1GB.zip
= iperf =
This measures the bandwidth between two locations where one is set as a server and another as a client. Note there is <code>iperf</code> and <code>iperf3</code> that are not compatible.
Start up server listening on port 8888. By default it is TCP port 5001 and TCP window size 64.0KB
<source lang=bash>
/opt/systems/bin/iperf -s -p 8888
</source>
Connect client to server on port 8888
<source lang=bash>
/opt/systems/bin/iperf -c your.server.com -l 1300 -p 8888 -P 10
</source>
<code>-P</code> splits the test into a number of streams. So, to just measure throughput use <code>-P 1</code>, then increase number of streams to get more realistic data.
{| class="wikitable"
|+ iperf3 of AWS VPN Gw and Azure Virtual Network Gateway. Note -R flag reverse the direction of a test, so that the server sends data to the client.
|-
! Server listening (AWS)
! Client connecting (Azure)
|-
| <source lang="bash">
ec2-user@linux2 10.111.1.11$ iperf3 -s -p 8888
-----------------------------------------------------------
Server listening on 8888
-----------------------------------------------------------
Accepted connection from 10.222.2.22, port 34510
[  8] local 10.111.1.11 port 8888 connected to 10.222.2.22 port 34512
[ ID] Interval          Transfer    Bandwidth      Retr  Cwnd
[  8]  0.00-1.00  sec  73.2 MBytes  614 Mbits/sec  279    561 KBytes
[  8]  1.00-2.00  sec  69.9 MBytes  587 Mbits/sec  14    450 KBytes
[  8]  2.00-3.00  sec  56.5 MBytes  474 Mbits/sec    6    402 KBytes
[  8]  3.00-4.00  sec  65.4 MBytes  548 Mbits/sec    0    507 KBytes
[  8]  4.00-5.00  sec  70.3 MBytes  589 Mbits/sec    0    596 KBytes
[  8]  5.00-6.00  sec  69.9 MBytes  587 Mbits/sec  18    502 KBytes
[  8]  6.00-7.00  sec  73.7 MBytes  619 Mbits/sec    0    596 KBytes
[  8]  7.00-8.00  sec  63.1 MBytes  529 Mbits/sec    6    509 KBytes
[  8]  8.00-9.00  sec  73.4 MBytes  616 Mbits/sec    6    423 KBytes
[  8]  9.00-10.00  sec  54.4 MBytes  456 Mbits/sec    4    398 KBytes
[  8]  10.00-10.04  sec  2.69 MBytes  536 Mbits/sec    0    402 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval          Transfer    Bandwidth      Retr
[  8]  0.00-10.04  sec  672 MBytes  562 Mbits/sec  333            sender
[  8]  0.00-10.04  sec  0.00 Bytes  0.00 bits/sec                  receiver
</source>
| <source lang=bash> ubuntu@bastion-1:~$ iperf3 -c 10.111.1.11 -l 1300 -p 8888 -P 1 -R
Connecting to host 10.111.1.11, port 8888
Reverse mode, remote host 10.111.1.11 is sending
[  4] local 10.222.2.22 port 34512 connected to 10.111.1.11 port 8888
[ ID] Interval          Transfer    Bandwidth
[  4]  0.00-1.00  sec  74.1 MBytes  622 Mbits/sec
[  4]  1.00-2.00  sec  69.4 MBytes  582 Mbits/sec
[  4]  2.00-3.00  sec  55.6 MBytes  467 Mbits/sec
[  4]  3.00-4.00  sec  66.4 MBytes  557 Mbits/sec
[  4]  4.00-5.00  sec  70.9 MBytes  595 Mbits/sec
[  4]  5.00-6.00  sec  69.3 MBytes  581 Mbits/sec
[  4]  6.00-7.00  sec  74.2 MBytes  623 Mbits/sec
[  4]  7.00-8.00  sec  62.7 MBytes  526 Mbits/sec
[  4]  8.00-9.00  sec  73.0 MBytes  613 Mbits/sec
[  4]  9.00-10.00  sec  54.1 MBytes  454 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval          Transfer    Bandwidth      Retr
[  4]  0.00-10.00  sec  672 MBytes  564 Mbits/sec  333            sender
[  4]  0.00-10.00  sec  670 MBytes  562 Mbits/sec                  receiver
</source>
|}


wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
 
Switches:
<source lang=bash>
# -s --server run in server mode, -D run as a daemon in the background
# -c --client connect to server from client
# -t time option tells to transfer data for X seconds
# -p --port server port to listen on/connect to
# -P --parallel n parallel client streams, iperf3 is single threaded, so if you are CPU bound, this will not yield higher throughput.
# -l --len length of buffer to read or write (default 8 KB)
# -w desired window size value
# -u --udp use UDP rather than TCP
# -M --mss set TCP maximum segment size (MTU - 40 bytes)
# -f m displays results in megabytes
# -r bidirectional test individually, use -d --dualtest to test simultaneously
</source>


= References =
= References =
*[http://binarynature.blogspot.co.uk/2013/03/measure-internet-connection-speed-from-linux-command-line.html Measure Internet Connection Speed from the Linux Command Line]
*[http://binarynature.blogspot.co.uk/2013/03/measure-internet-connection-speed-from-linux-command-line.html Measure Internet Connection Speed from the Linux Command Line]

Latest revision as of 13:17, 3 June 2019

Speedtest.net

sudo apt-get install python-pip
 pip install speedtest-cli

or:

sudo apt-get install python-setuptools
 sudo easy_install speedtest-cli

This 2nd solution worked on AWS Ubuntu 13.04 Server and it needed ~3Mb (python-setuptools) to download versus ~80Mb for python-pip

Run the speedtest:

$ speedtest-cli 
 Retrieving speedtest.net configuration...
 Retrieving speedtest.net server list...
 Testing from Global Crossing (217.156.150.69)...
 Selecting best server based on latency...
 Hosted by Gigaclear PLC (Slough) [8.91 km]: 13.461 ms
 Testing download speed........................................
 Download: 23.93 Mbit/s
 Testing upload speed..................................................
 Upload: 12.27 Mbit/s

Wget

wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
wget -O /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip
curl -o /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip

wget -O /dev/null http://ipv4.download.thinkbroadband.com/1GB.zip
wget -O /dev/null http://ipv4.download.thinkbroadband.com:81/1GB.zip
wget -O /dev/null http://ipv4.download.thinkbroadband.com:8080/1GB.zip

iperf

This measures the bandwidth between two locations where one is set as a server and another as a client. Note there is iperf and iperf3 that are not compatible.

Start up server listening on port 8888. By default it is TCP port 5001 and TCP window size 64.0KB

/opt/systems/bin/iperf -s -p 8888


Connect client to server on port 8888

/opt/systems/bin/iperf -c your.server.com -l 1300 -p 8888 -P 10

-P splits the test into a number of streams. So, to just measure throughput use -P 1, then increase number of streams to get more realistic data.


iperf3 of AWS VPN Gw and Azure Virtual Network Gateway. Note -R flag reverse the direction of a test, so that the server sends data to the client.
Server listening (AWS) Client connecting (Azure)
ec2-user@linux2 10.111.1.11$ iperf3 -s -p 8888
-----------------------------------------------------------
Server listening on 8888
-----------------------------------------------------------
Accepted connection from 10.222.2.22, port 34510
[  8] local 10.111.1.11 port 8888 connected to 10.222.2.22 port 34512
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  8]   0.00-1.00   sec  73.2 MBytes   614 Mbits/sec  279    561 KBytes
[  8]   1.00-2.00   sec  69.9 MBytes   587 Mbits/sec   14    450 KBytes
[  8]   2.00-3.00   sec  56.5 MBytes   474 Mbits/sec    6    402 KBytes
[  8]   3.00-4.00   sec  65.4 MBytes   548 Mbits/sec    0    507 KBytes
[  8]   4.00-5.00   sec  70.3 MBytes   589 Mbits/sec    0    596 KBytes
[  8]   5.00-6.00   sec  69.9 MBytes   587 Mbits/sec   18    502 KBytes
[  8]   6.00-7.00   sec  73.7 MBytes   619 Mbits/sec    0    596 KBytes
[  8]   7.00-8.00   sec  63.1 MBytes   529 Mbits/sec    6    509 KBytes
[  8]   8.00-9.00   sec  73.4 MBytes   616 Mbits/sec    6    423 KBytes
[  8]   9.00-10.00  sec  54.4 MBytes   456 Mbits/sec    4    398 KBytes
[  8]  10.00-10.04  sec  2.69 MBytes   536 Mbits/sec    0    402 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  8]   0.00-10.04  sec   672 MBytes   562 Mbits/sec  333             sender
[  8]   0.00-10.04  sec  0.00 Bytes  0.00 bits/sec                  receiver
ubuntu@bastion-1:~$ iperf3 -c 10.111.1.11 -l 1300 -p 8888 -P 1 -R
Connecting to host 10.111.1.11, port 8888
Reverse mode, remote host 10.111.1.11 is sending
[  4] local 10.222.2.22 port 34512 connected to 10.111.1.11 port 8888
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  74.1 MBytes   622 Mbits/sec
[  4]   1.00-2.00   sec  69.4 MBytes   582 Mbits/sec
[  4]   2.00-3.00   sec  55.6 MBytes   467 Mbits/sec
[  4]   3.00-4.00   sec  66.4 MBytes   557 Mbits/sec
[  4]   4.00-5.00   sec  70.9 MBytes   595 Mbits/sec
[  4]   5.00-6.00   sec  69.3 MBytes   581 Mbits/sec
[  4]   6.00-7.00   sec  74.2 MBytes   623 Mbits/sec
[  4]   7.00-8.00   sec  62.7 MBytes   526 Mbits/sec
[  4]   8.00-9.00   sec  73.0 MBytes   613 Mbits/sec
[  4]   9.00-10.00  sec  54.1 MBytes   454 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   672 MBytes   564 Mbits/sec  333             sender
[  4]   0.00-10.00  sec   670 MBytes   562 Mbits/sec                  receiver


Switches:

# -s --server run in server mode, -D run as a daemon in the background
# -c --client connect to server from client
# -t time option tells to transfer data for X seconds
# -p --port server port to listen on/connect to
# -P --parallel n parallel client streams, iperf3 is single threaded, so if you are CPU bound, this will not yield higher throughput.
# -l --len length of buffer to read or write (default 8 KB)
# -w desired window size value
# -u --udp use UDP rather than TCP
# -M --mss set TCP maximum segment size (MTU - 40 bytes)
# -f m displays results in megabytes
# -r bidirectional test individually, use -d --dualtest to test simultaneously

References