InfrawireInfrawire LogoDocumentation
Appeler

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:

Bash
1# Uninstall speedtest-cli (Python version via pip) 2sudo pip3 uninstall speedtest-cli -y 2>/dev/null || true 3 4# Uninstall speedtest-cli (system version) 5sudo apt remove speedtest-cli -y 2>/dev/null || true 6sudo apt purge speedtest-cli -y 2>/dev/null || true 7 8# Uninstall speedtest (official version via apt if present) 9sudo apt remove speedtest -y 2>/dev/null || true 10sudo apt purge speedtest -y 2>/dev/null || true 11 12# Clean residual files 13sudo apt autoremove -y 14sudo apt autoclean -y

Important: Uninstalling old versions is necessary because only installation via curl works correctly with Ookla's official version.

Speedtest is Ookla's official tool, the same service as speedtest.net. Installation is done only via curl:

Bash
1# Install Speedtest via Ookla's official script 2curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash 3 4# Install speedtest 5sudo apt install speedtest -y

Verify Installation

Bash
1# Verify that speedtest is installed 2speedtest --version 3 4# Test that speedtest works 5speedtest --help

🚀 Using Speedtest

Basic Test

Bash
# Simple test (automatically selects the best server) speedtest

Test with Options

Bash
1# Simple test (concise results) 2speedtest --simple 3 4# Test with units in bits per second 5speedtest --bits 6 7# Display only JSON results 8speedtest --json 9 10# Save JSON results to a file 11speedtest --json > speedtest-result.json

Choose a Specific Server

Bash
1# List available Speedtest servers 2speedtest --list 3 4# Filter servers by region (e.g., France, Paris) 5speedtest --list | grep -i "france\|paris" 6 7# Test to a specific server (use server ID) 8speedtest --server SERVER_ID 9 10# Example with a French server 11speedtest --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

Bash
1# Simple format (one line) 2speedtest --format=simple 3 4# CSV format 5speedtest --format=csv 6 7# JSON format (for scripts) 8speedtest --format=json 9 10# JSON format with progress 11speedtest --format=jsonl

Test with Server and Custom Format

Bash
1# Test to specific server with JSON format 2speedtest --server 45170 --format=json 3 4# Save to a file 5speedtest --server 45170 --format=json > speedtest-paris.json

Useful Options

Bash
1# Don't display intermediate results (progress) 2speedtest --progress=no 3 4# Display progress 5speedtest --progress=yes 6 7# Automatically accept license 8speedtest --accept-license 9 10# Accept GDPR cookies 11speedtest --accept-gdpr

🎯 Specific Tests

Test to Different Regions

Bash
1# List servers by region 2speedtest --list | grep -i "france\|paris\|frankfurt\|london\|amsterdam" 3 4# Test to a French server (example with ID) 5speedtest --server 45170 6 7# Test to multiple servers for comparison 8for server in 45170 45171 12345; do 9 echo "=== Testing server $server ===" 10 speedtest --server $server --simple 11 echo "" 12done

Complete Test Script

Create a script to perform multiple tests:

Bash
1#!/bin/bash 2 3echo "=== VPS Bandwidth Test ===" 4echo "" 5 6echo "1. Speedtest (best server):" 7echo "-------------------------------------" 8speedtest --simple 9 10echo "" 11echo "2. Test to French server (Paris):" 12echo "-------------------------------------" 13speedtest --server 45170 --simple 14 15echo "" 16echo "3. Detailed test:" 17echo "-------------------------------------" 18speedtest --format=simple 19 20echo "" 21echo "Test completed!"

Save the script and make it executable:

Bash
1# Create the script 2nano test-bandwidth.sh 3# Copy the content above 4 5# Make executable 6chmod +x test-bandwidth.sh 7 8# Run 9./test-bandwidth.sh

Repeated Test (Monitoring)

Bash
1# Speedtest repeated every hour 2while true; do 3 echo "=== $(date) ===" 4 speedtest --simple 5 echo "" 6 sleep 3600 7done

Save Results

Bash
1# Save results to a file 2speedtest --format=simple > speedtest-$(date +%Y%m%d-%H%M%S).txt 3 4# Save in JSON for later processing 5speedtest --format=json > speedtest-$(date +%Y%m%d-%H%M%S).json 6 7# Save with append (add to end of file) 8speedtest --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
  • VPS Ryzen : 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

Bash
1# Check CPU load 2top 3htop 4 5# Check network usage 6iftop 7nethogs 8 9# Check network errors 10ip -s link show 11 12# Check processes using bandwidth 13sudo nethogs

Problem with speedtest

If speedtest doesn't work correctly:

Bash
1# Verify that speedtest is installed 2which speedtest 3speedtest --version 4 5# Reinstall speedtest 6# First, uninstall 7sudo apt remove speedtest -y 8sudo apt purge speedtest -y 9 10# Then reinstall 11curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash 12sudo apt install speedtest -y 13 14# Verify it works 15speedtest --version

Error "speedtest: command not found"

Bash
1# Check if speedtest is installed 2which speedtest 3 4# If not found, reinstall 5curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash 6sudo apt install speedtest -y 7 8# Add to PATH if necessary 9echo 'export PATH=$PATH:/usr/bin' >> ~/.bashrc 10source ~/.bashrc

Permission Error

Bash
1# If you get a permission error, use sudo 2sudo speedtest 3 4# Or add your user to the appropriate group 5# (generally not necessary for speedtest)

Tests Can't Find Server

Bash
1# List available servers 2speedtest --list 3 4# Test to a specific server by its ID 5speedtest --server SERVER_ID 6 7# Check Internet connectivity 8ping -c 3 8.8.8.8 9curl -I https://www.speedtest.net

📝 Useful Commands

Quick Test with Simple Results

Bash
1# Simple one-line test 2speedtest --simple 3 4# Test with specific server 5speedtest --server 45170 --simple 6 7# Save results 8speedtest --simple > speedtest-result.txt

Test with JSON Results for Scripts

Bash
1# Test with JSON format 2speedtest --format=json 3 4# Save in JSON 5speedtest --format=json > result.json 6 7# Extract specific values with jq (if installed) 8speedtest --format=json | jq '.download.bandwidth, .upload.bandwidth, .ping.latency'

Continuous Monitoring

Bash
1# Test every hour with logs 2while true; do 3 echo "$(date): $(speedtest --simple 2>&1)" >> /var/log/speedtest.log 4 sleep 3600 5done

📚 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.