Master Linux Network Speed Testing: From Ping to Advanced Tools
This guide walks you through a complete set of Linux network‑speed testing utilities—from the built‑in ping command to curl/wget downloads, Speedtest‑CLI, iperf3, iftop, nload, nethogs, bmon and vnstat—explaining installation, core metrics, usage examples, and practical tips for accurate measurement and troubleshooting.
Why Measure Network Speed on Linux?
When a manager asks you to quickly assess network performance on a Linux server, you need a reliable toolbox that covers latency, bandwidth, and traffic monitoring. This article provides a systematic overview from basic commands to advanced utilities, showing when to use each tool and how to interpret the results.
Entry‑Level: Built‑In Commands
1. ping – Quick Latency Check
All Linux distributions include ping. It sends ICMP echo requests and reports three key values:
time : round‑trip time per packet (ideal < 20 ms, > 50 ms may indicate issues)
packet loss : percentage of lost packets (0 % is ideal)
avg : average latency, reflecting overall stability
Example: ping -c 10 www.baidu.com Limitation: ping only measures delay, not bandwidth.
2. curl / wget – Real‑World Download Speed
Downloading a file gives a direct view of throughput.
# curl example
curl -o /dev/null https://nbg1-speed.hetzner.com/100MB.bin
# wget example
wget -O /dev/null https://nbg1-speed.hetzner.com/100MB.binThe terminal prints the instantaneous speed, e.g., 15.2 MB/s (≈ 120 Mbps).
Intermediate: Professional Testing Tools
3. Speedtest‑CLI – Command‑Line Bandwidth Test
Official Speedtest client for the CLI, offering standardized results.
# Install via pip
pip install speedtest-cli
# Or via apt (Ubuntu/Debian)
sudo apt install speedtest-cliBasic usage:
# One‑click test
speedtest-cli
# Simple output only
speedtest-cli --simple
# List servers and select one (e.g., Shanghai)
speedtest-cli --list | grep Shanghai
speedtest-cli --server SERVER_ID4. iperf3 – Precise LAN Bandwidth Measurement
Ideal for measuring throughput between two hosts.
# Ubuntu/Debian
sudo apt install iperf3
# CentOS/RHEL
sudo yum install iperf3Server side: iperf3 -s Client side examples:
# Basic test
iperf3 -c SERVER_IP
# Test for 30 seconds
iperf3 -c SERVER_IP -t 30
# Reverse test (measure upload)
iperf3 -c SERVER_IP -R
# Parallel test with 10 streams
iperf3 -c SERVER_IP -P 105. iftop – Real‑Time Traffic Monitor
Shows which processes or connections consume bandwidth.
# Install
sudo apt install iftop # Ubuntu/Debian
sudo yum install iftop # CentOS/RHELRun and optional flags:
# Monitor default interface
sudo iftop
# Specify interface
sudo iftop -i eth0
# Show ports instead of service names
sudo iftop -PKey shortcuts while running:
Press t to toggle display mode
Press n to show port numbers
Press s to show source host
Press d to show destination host
6. nload – ASCII Graphical Bandwidth Display
Provides a clear, continuously updating graph of inbound and outbound traffic.
# Install (CentOS/RHEL example)
sudo yum install nloadUsage examples:
# Monitor all interfaces
nload
# Monitor a specific interface
nload ens33
# Set refresh interval to 1 second
nload -t 10007. nethogs – Per‑Process Bandwidth Usage
Shows real‑time upload/download rates per process, helping you locate hidden traffic.
# Install
sudo yum install nethogs
# Run
sudo nethogs8. bmon – Professional Bandwidth Monitor
Offers richer statistics and graphical output.
# Install
sudo yum install bmon
# Run
bmon9. vnstat – Persistent Traffic Statistics Daemon
Runs in the background, recording traffic for daily, monthly, and live views.
# Install and start service
sudo yum install vnstat
sudo systemctl start vnstat
# Show today's traffic
vnstat -d
# Show monthly summary
vnstat -m
# Live speed display
vnstat -lPractical Tips for Accurate Measurements
Permissions : Most tools require root; prepend sudo when needed.
Firewall : Open port 5201/tcp for iperf3.
sudo firewall-cmd --add-port=5201/tcp --permanentMultiple Runs : Network speed fluctuates; run several tests and average the results.
Server Selection : For external tests, choose a server geographically close to reduce latency bias.
Combine Tools : Use ping to verify connectivity, speedtest‑cli for broadband, then iftop or nload for real‑time monitoring.
Conclusion
With this toolbox—ping, curl/wget, Speedtest‑CLI, iperf3, iftop, nload, nethogs, bmon, and vnstat—you can confidently answer any Linux network‑speed query, diagnose issues, and fine‑tune performance. Remember, the tools are only aids; understanding the underlying network principles is essential for effective troubleshooting.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
