Use traceroute for a quick path snapshot, and use mtr when you need proof over time. That is the simple rule for troubleshooting Linux network connections. If a website feels slow, a game server lags, or an API keeps timing out, these two tools show where packets get grumpy.
TLDR: traceroute shows the route from your Linux machine to a target, one hop at a time. mtr does the same thing, but keeps testing each hop until you stop it. For example, if users in one office see 18% packet loss to api.example.com, mtr can show whether the loss starts at the office router, the ISP, or near the server. Use traceroute for a fast check, then use mtr when someone says, “It was fine five minutes ago.”
What traceroute does
traceroute is like asking your packet, “Where did you go?” It sends test packets toward a destination. Each router on the way answers back. Those routers are called hops.
A basic command looks like this:
traceroute google.com
You may see output like this:
1 192.168.1.1 1.2 ms 1.1 ms 1.3 ms
2 10.20.0.1 8.4 ms 8.9 ms 8.5 ms
3 isp-router.net 15.3 ms 16.1 ms 15.8 ms
4 * * *
5 142.250.190.14 31.0 ms 30.7 ms 31.2 ms
Each line is a hop. The three times are round-trip times. Lower is usually better. A star means no reply came back for that test.
Do not panic at one line of stars. Some routers ignore these probes. They may still forward traffic just fine. Routers can be rude like that.
What mtr does
mtr stands for My Traceroute. Think of it as traceroute with a stopwatch and a clipboard. It keeps sending probes. It updates the results live.
Run it like this:
mtr google.com
For a report you can paste into a ticket, use:
mtr -rw google.com
The -r option prints a report. The -w option makes hostnames easier to read. You can also set the number of test packets:
mtr -rw -c 100 google.com
That sends 100 probes. This is much better than judging a network from one tiny sample. Honestly, it feels like blaming one raindrop for a flood.
Traceroute vs mtr: the simple difference
traceroute: one quick route check.mtr: continuous route testing with packet loss and timing stats.tracerouteis great for: “Where does the path go?”mtris great for: “Where does it break over time?”
If you only need a map, use traceroute. If you need evidence, use mtr.
How to install them on Linux
On Debian or Ubuntu:
sudo apt update
sudo apt install traceroute mtr
On Fedora:
sudo dnf install traceroute mtr
On RHEL, Rocky, or AlmaLinux:
sudo dnf install traceroute mtr
On Arch Linux:
sudo pacman -S traceroute mtr
Some systems already include one tool but not the other. It drives me crazy that a clean server can have five text editors and still miss basic network tools. Expect to install at least one package.
How to read traceroute without yelling
Start with these clues:
- Hop 1 is your local router. If this is slow, check Wi-Fi, cables, or the local gateway.
- Early hops are close to you. Trouble there often points to your network or ISP.
- Late hops are closer to the destination. Trouble there may be near the server or hosting provider.
- One bad middle hop may not matter. If later hops look fine, that router may just dislike probe replies.
- Loss at the final hop matters most. Packet loss there often means real user pain.
Here is the trick. Look for where the problem starts and whether it continues. If hop 6 shows 40% loss, but hops 7 through 12 show 0% loss, hop 6 is probably just ignoring some probes. Annoying? Yes. A crisis? Maybe not.
How to read mtr like a calm person
mtr output often includes these columns:
- Loss%: packet loss at that hop.
- Snt: number of packets sent.
- Last: last measured latency.
- Avg: average latency.
- Best: fastest reply.
- Wrst: slowest reply.
- StDev: how much the latency jumps around.
High average latency is bad. High packet loss is worse. High jitter can also hurt calls, games, and video meetings. If Avg is 25 ms but Wrst is 900 ms, users may see random freezes. Those freezes are hard to explain without stats.
When to use traceroute
Use traceroute when you need a fast first answer.
- A site is unreachable.
- You want to see if traffic leaves your network.
- You want to compare routes from two servers.
- You need a quick clue before deeper testing.
Example:
traceroute api.example.com
If the route stops at your office firewall, start there. If it reaches many public routers and then dies, the issue may be outside your building.
When to use mtr
Use mtr when the issue comes and goes. This is where mtr is fantastic.
- Users report random timeouts.
- Latency spikes every few minutes.
- Calls sound robotic.
- A vendor asks for network proof.
- You suspect packet loss.
Example report command:
mtr -rw -c 200 api.example.com
This gives you 200 probes. That is enough to catch many flaky problems. If 200 packets show 12% loss at the final hop, that is not a “try again later” problem. That is data.
Common gotchas that waste time
ICMP may be blocked. Both tools often use ICMP or UDP probes. Firewalls may block replies. The service can still work.
DNS can slow the output. If names take too long to resolve, use numeric mode.
traceroute -n google.com
mtr -n google.com
Paths can be different both ways. Your packet may go out one path and return another. These tools usually show the forward path from your machine. The return path can still cause pain.
Cloud networks can hide details. Some providers mask internal routing. You may see stars or private IPs. That is normal.
Useful command options
Try these when the default output is not enough:
traceroute -n host: skip DNS names.traceroute -I host: use ICMP echo probes.traceroute -T host: use TCP SYN probes.mtr -n host: show IP addresses only.mtr -rw host: create a readable report.mtr -rw -c 100 host: send 100 probes, then print results.
TCP mode can help when ICMP is blocked. For example:
traceroute -T -p 443 example.com
This tests the path using TCP style probes toward port 443. That is useful for HTTPS issues.
A quick troubleshooting flow
- Ping the target. Check basic reachability.
- Run
traceroute. See the route. - Run
mtr. Watch loss and latency over time. - Compare from another network. Try home, office, cloud, or VPN.
- Save the output. Send it to your ISP, host, or network team.
A simple case helps. A small shop has 30 staff. Every afternoon, their CRM slows down. traceroute looks normal at 9 a.m. At 2 p.m., mtr -rw -c 300 crm.example.com shows 22% loss starting at the ISP’s second router. The office router shows 0% loss. The CRM server shows the same 22% loss. That points away from the office LAN and toward the ISP path. Now the complaint has teeth.
Final take
traceroute is the quick photo. mtr is the short movie. Use both. Start simple. Gather proof. Then you can stop guessing why Linux network connections feel broken.