Introduction to CLI Speed Testing
In modern networking, measuring throughput and latency quickly and accurately is essential. While web-based tools are popular, Command Line Interface (CLI) options grant automation, scripting capabilities, and lower overhead. This article dives deep into various CLI speed-test solutions, explains best practices, and offers advanced tips for power users.
Why Use CLI Over GUI
- Automation: Integrate tests into scripts or cron jobs.
- Low Overhead: Avoid browser dependencies and graphical rendering.
- Remote Access: Test directly on servers via SSH.
- Customization: Fine-tune parameters (server selection, concurrency, duration).
Popular CLI Speed Test Tools
1. speedtest-cli (Ookla)
speedtest-cli is one of the most widely used tools. It uses Ookla’s Speedtest.net infrastructure.
Installation
pip install speedtest-cli
Basic Usage
speedtest-cli
Key Options
--server ID: Specify server by ID.--csv: Output in CSV format for parsing.--mini URL: Test against a private server (Hosted by you).
2. fast-cli
fast-cli leverages Fast.com’s network for testing. It’s maintained by Netflix, focusing on download speed.
Installation
npm install --global fast-cli
Basic Usage
fast
3. iperf3
iperf3 is the go-to for point-to-point bandwidth measurement. It requires a client and server pairing.
Installation
sudo apt install iperf3
Usage
- On server:
iperf3 -s - On client:
iperf3 -c server_ip
Advanced Flags
-t: Test duration in seconds.-P: Number of parallel streams.-u: Use UDP instead of TCP.
Comparative Overview
| Tool | Strengths | Limitations |
|---|---|---|
| speedtest-cli | Global servers, CSV export | Dependent on third-party API |
| fast-cli | Simple, quick download speed | No latency or upload metrics |
| iperf3 | Custom server/client, in-depth metrics | Requires both endpoints |
Interpreting Speed Test Results
Understanding metrics is crucial:
- Download Bandwidth: Rate of data from the server to you (Mbps).
- Upload Bandwidth: Rate of data from you to the server (Mbps).
- Ping/Latency: Round-trip time (ms)—the lower, the better.
- Jitter: Variation in latency (ms), important for real-time apps.
Tip: Run tests multiple times and average the results to mitigate transient network fluctuations.
Enhancing Tests with VPNs and Proxies
Testing through different geographic endpoints or encrypted tunnels reveals real-world performance under diverse conditions.
- Use NordVPN to test how speed varies when connected to a distant country’s server.
- Try ExpressVPN for multi-protocol support and see the VPN overhead on throughput.
- Evaluate Surfshark with its unlimited-devices feature and test on multiple endpoints concurrently.
- Leverage ProtonVPN for secure, no-logs testing across premium network nodes.
Note: Always verify the VPN’s server location and protocol (OpenVPN, WireGuard) to interpret latency correctly.
Scripting and Automation
Automate tests to gather historical data or trigger alerts when speeds drop below thresholds.
Example Bash Script (speedtest-cli)
#!/bin/bash LOGFILE=~/speedtest_log.csv if [ ! -f LOGFILE ] then echo timestamp,download,upload,ping gt LOGFILE fi RESULT=(speedtest-cli --csv) echo (date %Y-%m-%d_%T),RESULT gtgt LOGFILE
Schedule via crontab -e:
0 /path/to/speedtest_script.sh
Troubleshooting Common Issues
- Permission Denied: Ensure executable bit (
chmod x) and correct Python/Node environment. - Server Unreachable: Specify a different server with
--serveror test connectivity (ping, traceroute). - VPN Interference: Disconnect VPN to test raw ISP performance reconnect to measure encrypted throughput.
- Firewall Restrictions: Open necessary ports (e.g., UDP 5201 for iperf3).
Best Practices and Tips
- Run tests at different times (peak vs. off-peak) to gauge network congestion.
- Document hardware and OS environment NIC drivers can affect results.
- Compare multiple tools: a single measurement may not reveal all issues.
- Use parallel streams (iperf3
-P) when testing multi-core network cards. - Monitor jitter for VoIP or gaming small ping alone doesn’t guarantee stable experience.
Conclusion
CLI speed-testing empowers network administrators and enthusiasts with precision, automation, and flexibility. By combining tools like speedtest-cli, fast-cli, and iperf3—and leveraging VPNs such as NordVPN or ExpressVPN—you can perform comprehensive analyses of your network’s performance. Embrace scripting for continuous monitoring, interpret your results critically, and employ best practices to maintain peak connectivity.
Leave a Reply