Comparing Network Diagnostic Tools on Linux
Every packet sent from your machine to a destination server traverses a series of intermediate routers (hops). If even a single router along the path gets overloaded or an undersea fiber-optic cable is cut, users immediately experience high latency or connection drops. In these situations, you need to know exactly where packets are being bottlenecked or dropped.
Common command-line tools approach this challenge in very different ways:
- Ping: Sends ICMP Echo Request packets to verify host availability and measure Round-Trip Time (RTT). Ping gives you fast results in 1–2 seconds. Its drawback is that it completely conceals the packet’s path. If ping reports 20% packet loss, you have no way of knowing whether the issue lies in your local switch or at the ISP’s gateway.
- Traditional Traceroute: Incrementally increases the packet’s TTL (Time-To-Live) value starting from 1 to force each intermediate router to return an ICMP Time Exceeded message, thereby reconstructing the path. However, traceroute defaults to sending only 3 UDP or ICMP probes per hop. This provides merely a static snapshot, making it virtually useless for catching intermittent or sporadic network glitches.
- MTR (My Traceroute): Combines the functionality of ping and traceroute into a real-time interface. MTR continuously sends probes to every hop along the route. It provides detailed real-time statistics: packet loss percentage (Loss%), average latency (Avg), lowest latency (Best), highest latency (Wrst), and latency variation (StDev).
- tcptraceroute: Overcomes firewall restrictions. Most edge routers and enterprise firewalls block ICMP and UDP packets outright, causing traditional traceroute to display nothing but asterisks (
* * *). In contrast, standard web ports (80, 443) must remain open.tcptraceroutesends TCP SYN packets directly to the actual service port, tracing each network segment without getting filtered by firewalls.
Technical Pros and Cons of Each Tool
No single tool is ideal for every scenario. Understanding how each packet type behaves helps you pick the right command and interpret the metrics accurately.
1. Ping and Traceroute
- Pros: Pre-installed on almost all Linux distributions. Quick to run and consumes negligible system resources.
- Cons: Extremely sparse sample sizes. More importantly, many ISPs rate-limit or deprioritize ICMP traffic on router control-plane CPUs, making ping statistics misleading when compared to real-world application traffic.
2. MTR (My Traceroute)
- Pros: Dynamic, real-time monitoring. Running MTR for just 2–3 minutes reveals clear trends in route degradation. Its ability to compute standard deviation (StDev) helps uncover jitter even when packet Loss% stays at 0%.
- Cons: Operates using ICMP by default. Intermediate routers rate-limiting ICMP responses can easily mislead operators into assuming there is an actual network outage.
3. tcptraceroute
- Pros: Pierces through the strictest firewalls. It reflects 100% of the exact network path taken by production application traffic (such as Nginx, MySQL, or API gateways).
- Cons: Lacks a dynamic, continuously updating dashboard like MTR. You have to invoke it manually for each run or write wrapper scripts for extended monitoring.
Practical Application: Troubleshooting Peak-Hour Packet Loss
The most frustrating issues in network operations are intermittent problems. Your API server occasionally throws HTTP 504 Gateway Timeouts. You SSH in, fire off a 10-packet ping, and observe a solid 15ms RTT with 0% loss. Yet, like clockwork during peak hours between 8 PM and 10 PM, users complain that the app hangs indefinitely.
In this scenario, traditional traceroute is utterly helpless. The proper solution is to run MTR continuously in the background for 15 minutes with a 100-packet cycle right when the incident occurs.
The empirical metrics will reveal the root cause: hops 1 through 3 (internal datacenter network) show 0% loss, but at hop 4 (international transit gateway), loss spikes to 18% and persists all the way to the destination server. Concurrently, StDev surges from 1.2ms up to 85ms. This serves as concrete proof when opening support tickets to request that your ISP reroute traffic to an alternate transit path.
Summary of tool selection rules:
- Diagnosing intermittent latency and packet loss: Use MTR. Run at least 50–100 probe cycles to gather a statistically reliable dataset.
- Suspected firewall blocking service ports: Use tcptraceroute. Invaluable when an IP responds to ping, but curl requests to port 443 or database ports time out.
- Hybrid approach: You can run MTR with the TCP flag (
mtr --tcp -P 443). However, when you need granular insight into SYN/ACK handshake behavior at individual hops,tcptracerouteremains the cleaner, more lightweight option.
Installation and Usage Guide on Linux
Step 1: Installing the Tools
Both utilities are available in the official repositories of major Linux distributions.
On Debian and Ubuntu:
sudo apt update
sudo apt install -y mtr-tiny tcptraceroute
On RHEL, Rocky Linux, and AlmaLinux:
sudo dnf install -y epel-release
sudo dnf install -y mtr tcptraceroute
Step 2: Analyzing Network Paths with MTR
To monitor a target interactively in real time, run MTR specifying the destination IP or domain:
mtr 1.1.1.1
The terminal display updates continuously as follows:
HOST: my-server Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.1.1 0.0% 50 0.4 0.5 0.3 1.1 0.2
2.|-- 10.0.0.1 0.0% 50 4.2 4.5 3.9 6.2 0.6
3.|-- 203.113.130.1 0.0% 50 12.1 12.8 11.5 18.0 1.4
4.|-- 203.113.180.45 60.0% 50 13.0 13.2 12.8 15.1 0.5
5.|-- 1.1.1.1 0.0% 50 12.4 12.6 12.0 14.2 0.6
Key metrics to remember:
- Loss%: Packet loss percentage at the current hop.
- Snt: Number of packets sent (wait for at least 50 packets before drawing conclusions).
- Last, Avg, Best, Wrst: RTT of the most recent packet, average latency, minimum latency, and maximum latency (in ms).
- StDev: Standard deviation of latency. A higher StDev indicates network instability (high jitter).
Common interpretation pitfall: In the table above, hop 4 reports 60% Loss%, yet hop 5 (the destination) shows 0.0%. This is not an issue. The router at hop 4 is merely enforcing ICMP rate-limiting to protect its control plane CPU, while traffic passing through it is still switched at line rate. You should only diagnose a network bottleneck when packet loss begins at a specific hop and persists across all subsequent hops down to the destination server.
When you need to export evidence for your ISP or attach it to a support ticket, use report mode:
# Send 100 packets, use -n to disable DNS resolution for faster execution
mtr --report --report-cycles 100 -n 1.1.1.1 > mtr_report_cloudflare.txt
Step 3: Using tcptraceroute to Bypass Firewalls and Test Service Ports
If standard traceroute displays only asterisks due to firewalls blocking ICMP, switch to tcptraceroute:
# Syntax: sudo tcptraceroute [domain/IP] [port]
sudo tcptraceroute itfromzero.com 443
Typical output:
Selected device eth0, address 192.168.1.50, port 52341 for outgoing packets
Tracing the path to itfromzero.com (104.21.45.12) on TCP port 443 (https), 30 hops max
1 192.168.1.1 0.512 ms 0.488 ms 0.461 ms
2 10.0.0.1 4.115 ms 3.980 ms 4.021 ms
3 203.113.130.1 12.301 ms 11.890 ms 12.110 ms
4 * * *
5 104.21.45.12 [open] 12.842 ms 12.650 ms 12.711 ms
The most critical indicator is the [open] flag at the target hop. This confirms that the TCP SYN packet reached the destination, port 443 is actively listening, and it responded with a standard SYN/ACK packet. The asterisks * * * at hop 4 simply indicate that that router does not return ICMP Time Exceeded packets, but it still forwarded your TCP packet safely to hop 5.
When debugging internal database ports (such as PostgreSQL 5432 or MySQL 3306) across VPCs or site-to-site VPN tunnels:
sudo tcptraceroute db.internal.company.com 5432
If the final hop reports [closed], network connectivity is intact all the way to the host, but the database service is either down or not bound to the correct IP address. Conversely, if the trace halts abruptly at an intermediate hop followed by persistent asterisks, a router or firewall at that specific hop is silently dropping your packets.

