A complete walkthrough for installing the Ookla speedtest binary on your GL.iNet Flint 2 router, scheduling hourly tests via cron, logging results to CSV, and rendering them as a live dashboard — all running locally on the router itself.
This guide assumes a GL.iNet Flint 2 (GL-MT6000) running OpenWrt with SSH access enabled. The same approach works on most ARM64-based OpenWrt routers — just confirm the architecture before downloading the speedtest binary.
uname -a. The Flint 2 uses MediaTek MT7986 — different to the older Flint 1 which needs armel.root@192.168.8.1. Enable from LuCI → System → Administration if not already on./www/ on port 80 — that's where the dashboard goes. No extra packages required./root/ lives).Each Ookla test consumes roughly 2.5 GB of data on a gigabit connection. Plan your schedule accordingly — recommendations are in step 4.
SSH into your router as root, then download and extract the official Ookla speedtest CLI binary for ARM64. This is a single static binary — no dependencies, no package manager required.
# SSH in (from your computer) ssh root@192.168.8.1 # Download, extract, and accept license on first run cd /root wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-aarch64.tgz tar xzf ookla-speedtest-1.2.0-linux-aarch64.tgz ./speedtest --accept-license --accept-gdpr
You should see a clean test result with download speed, upload speed, latency, and a result URL. If you get an "unterminated quoted string" error, you've grabbed the wrong architecture — that error means the binary doesn't match your CPU.
Run ls -lh /root/speedtest. You should see a roughly 2.4 MB executable file owned by root.
OpenWrt has two main filesystem areas — and choosing the wrong one will silently destroy your data on every reboot.
mkdir -p /root/speedtest-data
This script runs the speedtest binary in machine-readable mode, parses the resulting CSV line, converts bytes-per-second into Mbps, and appends a clean row to a structured log file. The first time it runs, it writes a header.
Ookla's native CSV output is comma-separated with quoted fields and reports speeds in bytes per second. We convert to Mbps (multiply by 8, divide by 1,000,000) so the dashboard can display values familiar to anyone who's used speedtest.net.
#!/bin/sh DATAFILE="/root/speedtest-data/results.csv" # Write CSV header if file is new if [ ! -f "$DATAFILE" ]; then echo "timestamp,server,latency_ms,jitter_ms,packet_loss,download_mbps,upload_mbps" > "$DATAFILE" fi # Run speedtest, capture machine-readable CSV RAW=$(/root/speedtest --format=csv --accept-license --accept-gdpr --progress=no 2>/dev/null) if [ -z "$RAW" ]; then echo "$(date '+%Y-%m-%d %H:%M:%S'),ERROR,0,0,0,0,0" >> "$DATAFILE" exit 1 fi # Parse fields (awk strips the surrounding quotes) SERVER=$(echo "$RAW" | awk -F',' '{gsub(/"/, "", $1); print $1}') LATENCY=$(echo "$RAW" | awk -F',' '{gsub(/"/, "", $3); print $3}') JITTER=$(echo "$RAW" | awk -F',' '{gsub(/"/, "", $4); print $4}') PKT_LOSS=$(echo "$RAW" | awk -F',' '{gsub(/"/, "", $5); print $5}') # Convert bytes/sec to Mbps DL_BYTES=$(echo "$RAW" | awk -F',' '{gsub(/"/, "", $6); print $6}') UL_BYTES=$(echo "$RAW" | awk -F',' '{gsub(/"/, "", $7); print $7}') DL_MBPS=$(echo "$DL_BYTES" | awk '{printf "%.2f", $1/1000000*8}') UL_MBPS=$(echo "$UL_BYTES" | awk '{printf "%.2f", $1/1000000*8}') TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') echo "$TIMESTAMP,$SERVER,$LATENCY,$JITTER,$PKT_LOSS,$DL_MBPS,$UL_MBPS" >> "$DATAFILE"
# Use the cat << 'EOF' technique to paste the whole script in one go cat > /root/speedtest-log.sh << 'EOF' # ... paste the script body here ... EOF chmod +x /root/speedtest-log.sh # Run it once to verify /root/speedtest-log.sh cat /root/speedtest-data/results.csv
cat << 'EOF' with single quotes?
Single-quoting 'EOF' tells the shell not to expand $variables as you paste — meaning $DATAFILE stays literal in the file rather than being substituted into emptiness.
OpenWrt's cron daemon reads schedules from /etc/crontabs/root. Append one line, restart the daemon, done.
Each test uses ~2.5 GB. Pick what suits your bandwidth.
# Append the schedule (every 6 hours) echo "0 */6 * * * /root/speedtest-log.sh" >> /etc/crontabs/root # Restart cron to pick up the change /etc/init.d/cron restart # Verify it's there crontab -l
Rather than copying the CSV into /www/ on every update, create a symbolic link. uhttpd will follow it and serve the live file straight from /root/speedtest-data/.
ln -s /root/speedtest-data/results.csv /www/speedtest-results.csv # Test it from your browser: # http://192.168.8.1/speedtest-results.csv
uhttpd is bound to your LAN interface, so the dashboard is only accessible from devices on your home network. It's not exposed to the internet unless you've explicitly forwarded port 80 (please don't).
The dashboard is a single HTML file. It loads Chart.js from a CDN, fetches the CSV, parses it client-side, and renders two line charts: one for bandwidth, one for latency. There's no server-side rendering — your browser does all the work.
<!DOCTYPE html> <html> <head> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> </head> <body> <canvas id="speedChart"></canvas> <canvas id="latencyChart"></canvas> <script> const res = await fetch('/speedtest-results.csv'); const rows = (await res.text()).trim().split('\n').slice(1); const labels = [], dl = [], ul = [], ping = []; rows.forEach(line => { const p = line.split(','); labels.push(p[0].substring(5, 16)); ping.push(parseFloat(p[2])); dl.push(parseFloat(p[5])); ul.push(parseFloat(p[6])); }); new Chart(document.getElementById('speedChart'), { type: 'line', data: { labels, datasets: [ { label: 'Download Mbps', data: dl, borderColor: '#4CAF50' }, { label: 'Upload Mbps', data: ul, borderColor: '#2196F3' } ]} }); </script> </body> </html>
Save it to /www/speedtest.html and visit http://192.168.8.1/speedtest.html from any device on your network. As cron fires throughout the day, the chart fills in.
Add ?_=' + Date.now() to your fetch URL so the browser doesn't serve a stale CSV from cache when you refresh the page.
aarch64 binary won't run on armel hardware. Run uname -a and check what your router actually is./etc/init.d/cron status. Also verify the script is executable (ls -l /root/speedtest-log.sh)./root/. Back up speedtest, speedtest-log.sh, and the cron entry before flashing.The CSV grows forever otherwise. Trim it weekly with another cron job that keeps only the last 500 rows:
echo "0 3 * * 0 tail -n 500 /root/speedtest-data/results.csv > /tmp/st_trim.csv && mv /tmp/st_trim.csv /root/speedtest-data/results.csv" >> /etc/crontabs/root /etc/init.d/cron restart