Operations 10 min read

How to Accurately Measure Network Speed on Linux: Tools & Tips

Learn a comprehensive, step‑by‑step guide to testing network performance on Linux, covering beginner commands like ping, download speed checks with curl/wget, advanced utilities such as speedtest‑cli, iperf3, iftop, nload, nethogs, bmon and vnstat, plus installation tips, usage examples, and practical advice for different scenarios.

dbaplus Community
dbaplus Community
dbaplus Community
How to Accurately Measure Network Speed on Linux: Tools & Tips

Beginner: Built‑in Commands

Ping is the simplest way to verify basic network connectivity and latency. ping -c 10 www.baidu.com Key metrics displayed by ping are:

time : round‑trip time for each packet (lower is better).

packet loss : percentage of lost packets (0 % is ideal).

avg : average latency, indicating overall stability.

Ping measures only delay, not bandwidth, but it is sufficient for an initial health check.

Download Speed with curl/wget

Downloading a large file with curl or wget shows the real‑world transfer rate.

# curl
curl -o /dev/null https://nbg1-speed.hetzner.com/100MB.bin

# wget
wget -O /dev/null https://nbg1-speed.hetzner.com/100MB.bin

The terminal reports a speed such as 15.2 MB/s , which corresponds to roughly 120 Mbps (1 MB/s ≈ 8 Mbps). Testing multiple servers lets you compare regional performance.

Advanced: Professional Tools

speedtest-cli

Official command‑line client for Speedtest.net, providing standardized bandwidth measurements.

# Install via pip
pip install speedtest-cli

# Install via apt (Ubuntu/Debian)
sudo apt install speedtest-cli

Basic usage examples:

# One‑shot test
speedtest-cli

# Concise output
speedtest-cli --simple

# List servers and select one (replace SERVER_ID with the desired ID)
speedtest-cli --list | grep <em>keyword</em>   # find SERVER_ID
speedtest-cli --server SERVER_ID

iperf3

Precise bandwidth testing between two hosts, suitable for LAN performance analysis.

# Install on Ubuntu/Debian
sudo apt install iperf3
# Install on CentOS/RHEL
sudo yum install iperf3

Start a server on the remote host: iperf3 -s Run client tests from the local host (replace SERVER_IP with the remote address):

# Basic test
iperf3 -c SERVER_IP

# Test for 30 seconds
iperf3 -c SERVER_IP -t 30

# Reverse mode (measure upload speed)
iperf3 -c SERVER_IP -R

# Ten parallel streams
iperf3 -c SERVER_IP -P 10

iftop

Real‑time traffic monitor that shows which connections consume bandwidth.

# Ubuntu/Debian
sudo apt install iftop
# CentOS/RHEL
sudo yum install iftop

Run the tool: sudo iftop Useful interactive keys:

t – toggle display mode

n – show numeric ports

s – show source hosts

d – show destination hosts

nload

ASCII‑graph bandwidth monitor that visualizes upload and download rates.

# CentOS/RHEL
sudo yum install nload

Monitor all interfaces: nload Monitor a specific interface and set a 1‑second refresh interval:

nload eth0
nload -t 1000

Expert: Deep Network Analysis

nethogs

Shows bandwidth usage per process, helping you pinpoint which applications consume traffic.

# CentOS/RHEL
sudo yum install nethogs
sudo nethogs

bmon

Bandwidth monitor with graphical output and detailed statistics.

# CentOS/RHEL
sudo yum install bmon
bmon

vnstat

Daemon that records traffic statistics for later analysis, providing daily, monthly, and live views.

# Install and start
sudo yum install vnstat
sudo systemctl start vnstat

# Show today's traffic
vnstat -d

# Show this month's traffic
vnstat -m

# Show live speed
vnstat -l

Scenario‑Based Selection Guide

Quick connectivity check: Use ping – fastest and most direct.

External download speed: Use speedtest-cli or curl / wget – standardized or raw transfer rate.

Server‑to‑server bandwidth: Use iperf3 – precise, configurable, supports multiple modes.

Traffic anomaly investigation: Use nethogs – identifies the offending process.

Real‑time network status: Use iftop or nload – visual, comprehensive information.

Historical traffic analysis: Use vnstat – stores data for trend comparison.

Practical Tips

Permissions: Most monitoring tools require root; prepend sudo when invoking them.

Firewall considerations: When using iperf3, ensure TCP port 5201 is open, e.g. sudo firewall-cmd --add-port=5201/tcp --permanent.

Multiple runs: Network speed fluctuates; run tests several times and average the results.

Server selection: For external tests, choose a server geographically close to obtain more accurate measurements.

Combined workflow: Ping first for latency, then run speedtest-cli (or curl / wget) for bandwidth, and finally monitor with iftop or nload for real‑time behavior.

CLILinuxnetwork testingiperf3speedtest-cli
dbaplus Community
Written by

dbaplus Community

Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.