Difference between revisions of "Internet speed test using Terminal"

From Ever changing code
Jump to navigation Jump to search
Line 35: Line 35:


= iperf =
= iperf =
This measures the bandwidth between two locations where one is set as a server and another as a client.
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
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
<source lang=bash>
/opt/systems/bin/iperf -s -p 8888
</source>
 


Connect client to server on port 8888
Connect client to server on port 8888
/opt/systems/bin/iperf -c your.server.com -l 1300 -p 8888 -P 10
<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.
 
 


Switches:
Switches:
:-t option used in the above command tells to transfer data for X seconds
<source lang=bash>
:-P divide results into X time frames aka lines printed
# -t option used in the above command 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.
:-w desired window size value
# -p --port server port to listen on/connect to
:-l, --len length of buffer to read or write (default 8 KB)
# -w desired window size value
:-u --udp use UDP rather than TCP
# -l, --len length of buffer to read or write (default 8 KB)
:-M, --mss set TCP maximum segment size (MTU - 40 bytes)
# -u --udp use UDP rather than TCP
:-f m displays results in megabytes
# -M, --mss set TCP maximum segment size (MTU - 40 bytes)
:-s, --server run in server mode, -D run as a daemon in the background
# -f m displays results in megabytes
:-c --client connect to server from client
# -s, --server run in server mode, -D run as a daemon in the background
:-r bidirectional test individually, use -d --dualtest to test simultaneously
# -c --client connect to server from client
# -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]

Revision as of 13:02, 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.


Switches:

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

References