Network Exploration—Internet

Speed Tests

You can measure your Internet connection's speed from your web browser using embedded graphical speed meters like Ookla, Speak Easy, and thinkbroadband. These meters measure the time it takes to exchange files then report the download and upload rates. Presumably: Each rate is the ratio of file size to transfer time or an average of ratios. The numerator is controlled by the meter and is thus a sharp figure. The denominator reflects factors other than line speed alone, like IP routes followed, server load, client load, browser speed, and transfer protocol. Although meters cannot deliver a pure measure of line speed because of such factors, they do provide a useful proxy for practical exchange rates.

To measure download speed from a shell, use wget or curl to grab a big file from some willing server, and monitor the transfer rate reported. For example:

-> wget -O /dev/null http://speedtest.newark.linode.com/100MB-newark.bin
⋮
… 104,857,600 … in 64s    

2014-08-24 17:47:13 (1.56 MB/s) - ‘/dev/null’ saved [104857600/104857600]

Whether MB connotes 1000 or 1024 is not immediately apparent, but you can let some arithmetic clarify if you care:

-> echo 'scale=2; print (104857600/64)/1000^2, " MB/s\n"'  | bc
1.63 MB/s
-> echo 'scale=2; print (104857600/64)/1024^2, " MiB/s\n"' | bc
1.56 MiB/s

For curl:

-> curl -o /dev/null http://speedtest.newark.linode.com/100MB-newark.bin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  100M  100  100M    0     0  1710k      0  0:00:59  0:00:59 --:--:-- 1666k
-> echo 'scale=2; print (104857600/59)/1000^2, " MB/s\n"'  | bc
1.77 MB/s
-> echo 'scale=2; print (104857600/59)/1024^2, " MiB/s\n"' | bc
1.69 MiB/s

For additional test files and server locations, see Linode.com (multiple cities) or Thinkbroadband.com (multiple sizes). For really big files, maybe grab the ISO image of a GNU/Linux distribution DVD.

To measure upload speed from a shell, you'll need a remote machine willing to receive your data, and you'll likely need an account on that machine. You can use scp or sftp to upload a test file. You can use dd to make a test file:

-> dd if=/dev/zero of=testfile count=100 bs=1MB 
100+0 records in
100+0 records out
100000000 bytes (100 MB) copied, 0.0242027 s, 4.1 GB/s

With scp:

-> scp testfile rnb@willing.receiver.net:/dev/null
testfile … 95MB 606.6KB/s   02:41
-> echo 'scale=2; print (100000000/161)/1000, " KB/s\n"'  | bc
621.11 KB/s
-> echo 'scale=2; print (100000000/161)/1024, " KiB/s\n"' | bc
606.56 KiB/s

With sftp:

-> echo "put testfile" | sftp rnb@willing.receiver.net -b
⋮
testfile … 95MB 495.7KB/s   03:17 
-> echo 'scale=2; print (100000000/197)/1000, " KB/s\n"'  | bc
507.61 KB/s
-> echo 'scale=2; print (100000000/197)/1024, " KiB/s\n"' | bc
495.71 KiB/s

With curl using SCP:

-> curl --upload-file testfile --user rnb scp://willing.receiver.net:/dev/null
Enter host password for user 'rnb':
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0 95.3M      0   525k --:--:--  0:03:05 --:--:--  525k

-> echo 'scale=2; print (100000000/185)/1000, " KB/s\n"'  | bc
540.54 KB/s
-> echo 'scale=2; print (100000000/185)/1024, " KiB/s\n"' | bc
527.87 KiB/s

With curl using SFTP

-> curl --upload-file testfile --user rnb sftp://willing.receiver.net:/dev/null
⋮
-> echo 'scale=2; print (100000000/716)/1000, " KB/s\n"'  | bc
139.66 KB/s

Finally, if you upload an actual file in lieu of using /dev/null, watch any quota on your remote account and remember to delete test files, local and remote.

Tips/thoughts: Test when home machine is not loaded with competing network activity. Test with the protocol you're most interested in. Use multiple servers when available. Note the units reported, particularly bytes versus bits: MBs or Mbs, KBs or Kbs. And note the base for K (and M): 1000 or 1024.

You can use wget to measure bandwidth directly from a router running Tomato firmware. First, start the SSH service on the router. (Navigate to Administration → Admin Access.) Then connect to the router as user root and run wget from that shell. Tomato's version of wget does not show progress. Instead, monitor transfer rates from Tomato's real-time bandwidth screen. (Navigate to Bandwidth/Real-Time.)

Website's Server Software

You can use curl to see what web-server software a website runs:

-> curl --silent --head rays-notebook.info | grep Server
Server: nginx
-> curl --silent --head google.com | grep Server
Server: gws
-> curl --silent --head upenn.edu | grep Server
Server: Apache/2.2.15 (Red Hat)

Equivalently:

-> curl -s -I rays-notebook.info | grep Server
Server: nginx

The website may choose not to identify its software:

-> curl --silent --head amazon.com | grep Server
Server: Server
-> curl --silent --head facebook.com | grep Server
-> [no output]

You can use wget, too:

-> wget rays-notebook.info --server-response --output-document /dev/null
⋮
Server: nginx
⋮

Or:

-> wget rays-notebook.info --server-response --output-document /dev/null 2>&1 | grep Server
  Server: nginx
-> wget rays-notebook.info -S -O /dev/null 2>&1 | grep Server
  Server: nginx