A Practical Network Toolbox: speedtest, iperf, mtr, besttrace and More
A cheat sheet for diagnosing server networking: measure bandwidth, spot packet loss, trace routes, and check DNS and connections — each with a one-line example.
When a server "feels slow," slowness is only a symptom. Is the bandwidth capped, is the link dropping packets, is the route taking a detour, or is DNS resolution hanging? Each tool below owns one part of the picture, and together they let you pinpoint the culprit fast. Examples target Ubuntu/Debian unless noted.
Install the tools first
Most of these ship in the official repositories, so one command covers them:
sudo apt update
sudo apt install -y speedtest-cli iperf3 mtr-tiny traceroute dnsutils curl iproute2
nexttrace and besttrace aren't in apt — grab their binaries from the respective project pages. ss is part of iproute2 and is usually preinstalled.
Quick reference
| Tool | What it's for | One-line example | |---|---|---| | speedtest-cli | Up/down bandwidth to a public test node | speedtest-cli --simple | | iperf3 | Point-to-point throughput between your own hosts | iperf3 -c SERVERIP | | mtr | Continuous per-hop latency and loss sampling | mtr -rwzbc 100 1.1.1.1 | | nexttrace / besttrace | Per-hop route plus IP geolocation | nexttrace 1.1.1.1 | | ping | Reachability and round-trip time | ping -c 4 1.1.1.1 | | traceroute | Which hops the packets pass through | traceroute 1.1.1.1 | | curl | HTTP reachability and per-phase timing | see below | | dig / nslookup | Look up DNS records | dig example.com +short | | ss | Local listening ports and connections | ss -tulnp |
By scenario
Bandwidth: speedtest and iperf3
speedtest-cli measures bandwidth from your server to a public test node on the internet, so it reflects your real-world uplink to the outside world. To measure actual throughput between two of your own hosts (a private network, or box-to-box across data centers), reach for iperf3: run iperf3 -s on one end as the server and iperf3 -c SERVERIP on the other; add -R to test the reverse (download) direction.
Loss and per-hop: mtr, ping, traceroute
ping tells you whether a host is reachable and how much latency there is; traceroute expands each intermediate hop. mtr combines the two and keeps sampling, which makes it the go-to for catching intermittent packet loss — -r for report mode, -c 100 for 100 samples, -w for wide output, -z to show ASNs.
Route and geography: nexttrace / besttrace
To see which country the traffic detours through and which carriers it crosses, run nexttrace 1.1.1.1 or besttrace 1.1.1.1. On top of the per-hop trace they annotate each IP's location and AS, which makes cross-border rerouting obvious.
HTTP and DNS: curl, dig
When a site is slow, curl breaks the request into timed phases:
curl -o /dev/null -s -w 'dns:%{time_namelookup} connect:%{time_connect} ttfb:%{time_starttransfer} total:%{time_total}\n' https://example.com
If a domain simply won't load, first confirm resolution with dig example.com A +short; nslookup is the older, equivalent tool.
Local connections: ss
ss -tulnp shows at a glance which ports are listening and which process owns each; ss -tn state established lists the connections that are currently active.
Summary
Keep the throughline in mind: speedtest/iperf3 for bandwidth, ping/mtr for loss, traceroute/nexttrace for routing, dig for DNS, curl for HTTP, and ss for local ports. Work down that list whenever the network "feels slow," and you'll usually narrow the trouble down to a single segment of the path.