⚡ Test VPS Bandwidth
This guide will teach you how to test your VPS bandwidth with Speedtest to verify network performance, measure download/upload speed, and identify potential connectivity issues.
📋 Prerequisites
- A VPS server with root or sudo access
- An active SSH connection
- Ubuntu/Debian (commands are adapted for these distributions)
🔧 Speedtest Installation
Uninstall Old Versions
Before installing Speedtest, it's important to uninstall all old versions to avoid conflicts:
# Uninstall speedtest-cli (Python version via pip) sudo pip3 uninstall speedtest-cli -y 2>/dev/null || true # Uninstall speedtest-cli (system version) sudo apt remove speedtest-cli -y 2>/dev/null || true sudo apt purge speedtest-cli -y 2>/dev/null || true # Uninstall speedtest (official version via apt if present) sudo apt remove speedtest -y 2>/dev/null || true sudo apt purge speedtest -y 2>/dev/null || true # Clean residual files sudo apt autoremove -y sudo apt autoclean -y
Important: Uninstalling old versions is necessary because only installation via curl works correctly with Ookla's official version.
Installation via curl (Recommended Method)
Speedtest is Ookla's official tool, the same service as speedtest.net. Installation is done only via curl:
# Install Speedtest via Ookla's official script curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash # Install speedtest sudo apt install speedtest -y
Verify Installation
# Verify that speedtest is installed speedtest --version # Test that speedtest works speedtest --help
🚀 Using Speedtest
Basic Test
# Simple test (automatically selects the best server) speedtest
Test with Options
# Simple test (concise results) speedtest --simple # Test with units in bits per second speedtest --bits # Display only JSON results speedtest --json # Save JSON results to a file speedtest --json > speedtest-result.json
Choose a Specific Server
# List available Speedtest servers speedtest --list # Filter servers by region (e.g., France, Paris) speedtest --list | grep -i "france\|paris" # Test to a specific server (use server ID) speedtest --server SERVER_ID # Example with a French server speedtest --server 45170
Example Output
Speedtest by Ookla
Server: Server Name - City (ID: 12345)
ISP: Your ISP
Latency: 12.45 ms (0.05 ms jitter)
Download: 945.23 Mbps (data used: 1.2 GB)
Upload: 842.15 Mbps (data used: 1.0 GB)
Packet Loss: 0.0%
Result URL: https://www.speedtest.net/result/c/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
📊 Advanced Options
Test with Custom Format
# Simple format (one line) speedtest --format=simple # CSV format speedtest --format=csv # JSON format (for scripts) speedtest --format=json # JSON format with progress speedtest --format=jsonl
Test with Server and Custom Format
# Test to specific server with JSON format speedtest --server 45170 --format=json # Save to a file speedtest --server 45170 --format=json > speedtest-paris.json
Useful Options
# Don't display intermediate results (progress) speedtest --progress=no # Display progress speedtest --progress=yes # Automatically accept license speedtest --accept-license # Accept GDPR cookies speedtest --accept-gdpr
🎯 Specific Tests
Test to Different Regions
# List servers by region speedtest --list | grep -i "france\|paris\|frankfurt\|london\|amsterdam" # Test to a French server (example with ID) speedtest --server 45170 # Test to multiple servers for comparison for server in 45170 45171 12345; do echo "=== Testing server $server ===" speedtest --server $server --simple echo "" done
Complete Test Script
Create a script to perform multiple tests:
#!/bin/bash echo "=== VPS Bandwidth Test ===" echo "" echo "1. Speedtest (best server):" echo "-------------------------------------" speedtest --simple echo "" echo "2. Test to French server (Paris):" echo "-------------------------------------" speedtest --server 45170 --simple echo "" echo "3. Detailed test:" echo "-------------------------------------" speedtest --format=simple echo "" echo "Test completed!"
Save the script and make it executable:
# Create the script nano test-bandwidth.sh # Copy the content above # Make executable chmod +x test-bandwidth.sh # Run ./test-bandwidth.sh
Repeated Test (Monitoring)
# Speedtest repeated every hour while true; do echo "=== $(date) ===" speedtest --simple echo "" sleep 3600 done
Save Results
# Save results to a file speedtest --format=simple > speedtest-$(date +%Y%m%d-%H%M%S).txt # Save in JSON for later processing speedtest --format=json > speedtest-$(date +%Y%m%d-%H%M%S).json # Save with append (add to end of file) speedtest --format=simple >> speedtest-history.txt
📊 Interpreting Results
Normal Speeds
Speeds depend on your VPS plan:
- Entry VPS : 100-250 Mbps
- Standard VPS : 250-500 Mbps
- Performance VPS : 500 Mbps - 1 Gbps
- Premium VPS : 1 Gbps and more
Normal Latency
- < 10 ms : Excellent (same datacenter)
- 10-50 ms : Very good (regional)
- 50-100 ms : Good (national)
- 100-200 ms : Acceptable (intercontinental)
- > 200 ms : High (possible problem)
Jitter (Latency Variation)
- < 1 ms : Excellent
- 1-5 ms : Good
- 5-10 ms : Acceptable
- > 10 ms : Possible problem
Packet Loss
- 0% : Perfect
- < 0.1% : Normal
- 0.1-1% : Acceptable
- > 1% : Network problem
Signs of Problems
- Speed < 50% of promised speed : Network problem
- Very variable latency (high jitter) : Network congestion
- Packet loss > 1% : Connectivity problem
- Speed drops over time : Limitation or throttling
✅ Best Practices
- Test multiple times : Performance can vary depending on network load
- Test at different times : Avoid peak hours for benchmark tests
- Test to different servers : Compare results to different locations
- Note results : Keep a record for future comparison
- Use JSON format : To automate and analyze results with scripts
🆘 Troubleshooting
Very Slow Speed
# Check CPU load top htop # Check network usage iftop nethogs # Check network errors ip -s link show # Check processes using bandwidth sudo nethogs
Problem with speedtest
If speedtest doesn't work correctly:
# Verify that speedtest is installed which speedtest speedtest --version # Reinstall speedtest # First, uninstall sudo apt remove speedtest -y sudo apt purge speedtest -y # Then reinstall curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash sudo apt install speedtest -y # Verify it works speedtest --version
Error "speedtest: command not found"
# Check if speedtest is installed which speedtest # If not found, reinstall curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash sudo apt install speedtest -y # Add to PATH if necessary echo 'export PATH=$PATH:/usr/bin' >> ~/.bashrc source ~/.bashrc
Permission Error
# If you get a permission error, use sudo sudo speedtest # Or add your user to the appropriate group # (generally not necessary for speedtest)
Tests Can't Find Server
# List available servers speedtest --list # Test to a specific server by its ID speedtest --server SERVER_ID # Check Internet connectivity ping -c 3 8.8.8.8 curl -I https://www.speedtest.net
📝 Useful Commands
Quick Test with Simple Results
# Simple one-line test speedtest --simple # Test with specific server speedtest --server 45170 --simple # Save results speedtest --simple > speedtest-result.txt
Test with JSON Results for Scripts
# Test with JSON format speedtest --format=json # Save in JSON speedtest --format=json > result.json # Extract specific values with jq (if installed) speedtest --format=json | jq '.download.bandwidth, .upload.bandwidth, .ping.latency'
Continuous Monitoring
# Test every hour with logs while true; do echo "$(date): $(speedtest --simple 2>&1)" >> /var/log/speedtest.log sleep 3600 done
📚 Additional Resources
❓ Frequently Asked Questions
Q: Why do I need to uninstall speedtest-cli before installing speedtest?
A: The old speedtest-cli version (installed via pip) is obsolete and can conflict with Ookla's official speedtest version. It's important to uninstall it to avoid problems.
Q: Why do my results vary between tests?
A: This is normal. Bandwidth can vary depending on network load, time, test servers used, and network congestion. Run multiple tests to get an average.
Q: Should I worry if speed is slightly lower than promised?
A: A 10-20% difference is normal. If speed is consistently more than 50% lower, contact support.
Q: How do I test upload bandwidth?
A: Speedtest automatically tests upload and download in the same test. Results include both values.
Q: Can I use speedtest to test between my VPS and my computer?
A: Speedtest only tests to public Speedtest.net servers. To test between your VPS and your computer, you'll need to use other tools like iperf3, but this is not covered in this guide.
Q: How do I interpret jitter?
A: Jitter is latency variation. Low jitter (< 5 ms) indicates a stable connection. High jitter (> 10 ms) can cause problems for latency-sensitive applications (voice, video).
Q: What is the difference between Mbps and MB/s?
A: Mbps (Megabits per second) is used for network bandwidth. MB/s (Megabytes per second) is used for storage. 1 MB/s = 8 Mbps. Speedtest displays in Mbps by default, use --bits to confirm.