The following script can be run from within a router, with no requirement that the speed test be performed using a PC:

  

# (All of these lines beginning with "#" are comments - no need to type them!)
#
# At the end of this script you will find the 4 commands listed for simple use
#
# Ensure SSH (port 22) is enabled/open on router
# Download PuTTY from www.putty.org
# Using PuTTY connect to the router
# Enter username+password for router ADMIN user
#Type the following commands to perform a speedtest

# The first command ("wget") downloads a 50MB file
#    *** If using pFsense use command "fetch" from the Shell:
#    *** fetch -o /dev/null http://download.thinkbroadband.com/50MB.zip
# (Other files: /100MB.zip and /1GB.zip)
# Whilst it downloads it will display the speed, such as below:
#
# 50MB.zip25%[====            ]12.50M  7.34MB/s
#
# OK, here's the command: (type it in, press Enter, and note the speed)

wget http://download.thinkbroadband.com/50MB.zip


# If we type the next command ("ls") we'll see the file is now downloaded
ls

# ...so let's remove it to save valuable memory space:
rm 50MB.zip

# ...and repeat the "ls" command to confirm it's removed:
ls

# The speed result is usually reported in "MB/s" rather than "Mb/s"
#To convert to mb/s simply multiply by 8
#(So if the speed was 7.xx MB/s, multiply 7 * 8)
#(...the result would be 56 Mb/s)
expr 7 * 8


# OK, now let's measure the latency:
ping 8.8.8.8 -c 1

#The result will look like below:
# round-trip min/avg/max = 18.387/18.387/18.387 ms
# (This is the latency in ms_____________^^^^^^^__)


# Finally, let's exit and disconnect:
exit



# As promised, here's the 4 simple commands:

wget http://download.thinkbroadband.com/50MB.zip
rm 50MB.zip
ping 8.8.8.8 -c 1
exit