mtr – A Comprehensive Guide to the Network Diagnostic Tool
mtr (My Traceroute) is a powerful open-source network diagnostic tool that combines the functionality of ping (continuous latency/availability checks) and traceroute (path discovery) to provide real-time insights into network path quality. Unlike traditional tools, mtr continuously sends packets to each hop along a route, measuring metrics like packet loss, latency, and jitter. This makes it ideal for troubleshooting intermittent connectivity, high latency, or packet loss across complex network paths where a single traceroute snapshot may miss transient issues.
Table of Contents#
- What is
mtr? - Installation
- Basic Usage
- Understanding
mtrOutput - Advanced Features and Options
- Common Use Cases
- Best Practices
- Limitations and Caveats
- References
1. What is mtr?#
mtr is a network diagnostic tool that traces the path to a target (e.g., a website, server, or IP) and continuously pings each intermediate hop (router, switch, etc.) along the way. It merges:
traceroute: Discovers the network path (via Time-to-Live (TTL) expiration).ping: Continuously measures latency, packet loss, and jitter for each hop.
How It Works#
mtr sends ICMP (or TCP/UDP) echo requests to each hop in the route. For each hop, it tracks:
- Packet loss (percentage of packets not returned).
- Round-Trip Time (RTT) metrics (minimum, average, maximum, and standard deviation).
2. Installation#
Linux#
- Debian/Ubuntu:
sudo apt-get install mtr-tiny(lightweight) ormtr(full curses UI). - RHEL/CentOS/Fedora:
sudo dnf install mtr(orsudo yum install mtron older systems). - Arch Linux:
sudo pacman -S mtr.
macOS#
- Homebrew:
brew install mtr(run withsudo mtror configure permissions). - Source: Compile from the official
mtrrepository using./bootstrap.sh && ./configure && make && sudo make install.
Windows#
mtr is not natively available on Windows, but there are several options:
- WSL (recommended): Install Windows Subsystem for Linux with Ubuntu, then run
sudo apt-get install mtrinside WSL. This gives you the full nativemtrexperience. - WinMTR: A GUI port that provides similar functionality for users who prefer a graphical interface.
- Cygwin: Build
mtrfrom source under Cygwin for a traditional Unix-like environment.
3. Basic Usage#
Command Syntax#
mtr [options] <target>Example Commands#
-
Basic Trace to a Domain (interactive mode):
mtr google.comThis runs
mtrin real-time, updating hop metrics continuously. -
Limit Packets per Hop (collect more data):
mtr -c 100 google.com # Send 100 packets to each hop -
IPv4/IPv6 Testing (force protocol):
- IPv4:
mtr -4 google.com - IPv6:
mtr -6 google.com(if the target supports IPv6).
- IPv4:
-
Quiet (Report) Mode (non-interactive, save output):
mtr -r -c 100 google.com > mtr_report.txt
4. Understanding mtr Output#
In interactive mode, mtr displays a table with columns:
| Column | Description |
|---|---|
Host | IP/hostname of the hop (router, switch, or destination). |
Loss% | Percentage of packets lost to this hop (0% = all packets returned). |
Snt | Number of packets sent to this hop. |
Last | RTT (ms) of the last packet sent. |
Avg | Average RTT (ms) for all packets. |
Best | Lowest (best) RTT (ms) observed. |
Wrst | Highest (worst) RTT (ms) observed. |
StDev | Standard deviation of RTT (measures latency consistency). |
Example Output (Simplified)#
Host Loss% Snt Last Avg Best Wrst StDev
192.168.1.1 0.0% 100 1.2 1.5 0.9 3.2 0.5 # Local router
10.0.0.1 0.0% 100 5.3 6.1 4.8 9.7 1.2 # ISP hop
203.0.113.1 2.0% 100 12.4 15.7 10.1 25.3 3.1 # Transit hop (2% loss)
74.125.142.100 0.0% 100 18.9 20.5 17.3 28.1 2.9 # Destination (Google)
Interpreting Metrics#
Key interpretation rules:
- Cumulative loss rule: Packet loss or increased latency at an intermediate hop is only a problem if it carries through to every subsequent hop, including the destination. A single hop showing 80% loss with a clean final hop usually means the router rate-limits ICMP responses — not that traffic is being dropped.
- Forward vs. return path: The path from A to B may differ from the return path B to A. If you see loss starting at a specific hop, the problem could be on the return path rather than at that hop. Run
mtrfrom both ends when possible to confirm. - Control Plane Policing: Many network operators rate-limit ICMP messages destined for the router itself. This causes intermediate hops to show high loss even though forwarded traffic passes through cleanly. Focus on the final hop's statistics to assess end-to-end health.
5. Advanced Features and Options#
Key Flags#
-
-n(Numeric Mode): Disable DNS resolution (show IPs only):mtr -n google.com -
-s <size>(Packet Size): Test with custom packet sizes (e.g., for MTU issues):mtr -s 1472 google.com # 1472-byte packets (leaves 28 bytes for headers) -
-P <port>(Port) + Protocol: Use TCP/UDP instead of ICMP (useful if ICMP is blocked):- TCP:
mtr --tcp -P 80 google.com(send TCP SYN to port 80). - UDP:
mtr --udp -P 53 google.com(send UDP to port 53, e.g., DNS). - SCTP:
mtr --sctp -P 80 google.com(send SCTP packets, for advanced use).
- TCP:
-
-b(Show IPs): Display both hostnames and IP addresses for each hop:mtr -b google.com -
-z(AS Lookup): Show the Autonomous System (AS) number for each hop (useful for identifying which network operator controls a hop):mtr -z google.com -
-e(MPLS): Display MPLS label information from ICMP extensions (pressein interactive mode to toggle):mtr -e google.com -
-f <ttl>(First TTL): Start probing at a specific TTL (skip early hops):mtr -f 5 google.com # Start at hop 5 -
-m <ttl>(Max TTL): Set the maximum number of hops to probe (default is 30):mtr -m 20 google.com
Output Formats#
mtr supports multiple output formats beyond the default interactive display:
- Report mode (
-r): Run for a set number of cycles and print a final summary:mtr -r -c 100 google.com - Wide report (
-w): Like report mode but does not truncate hostnames:mtr -w -r -c 100 google.com - JSON (
-j): Machine-readable output for automation and scripting. - CSV (
-C): Semi-colon separated values (note: separator is;, not,). - XML (
-x): Structured output for integration with monitoring tools. - Raw (
-l): Low-level output suitable for archival and custom parsing.
6. Common Use Cases#
Troubleshooting Latency#
If an app (e.g., video conferencing, SSH) is slow, run mtr to the server. Look for hops with:
- High
Avg/Wrstlatency. - High
StDev(variable latency).
Identifying Packet Loss#
For intermittent connectivity, check Loss% across hops:
- Loss at the first few hops? → Local network issue (e.g., Wi-Fi, faulty switch).
- Loss at intermediate hops? → ISP/transit provider issue.
ISP/DC Diagnostics#
Share mtr reports with your ISP to prove network issues (e.g., loss at their hop).
Gaming/Real-Time Apps#
Run mtr to the game server:
- High
Loss%orWrstlatency at a hop near the server → Explains lag.
Bidirectional Testing#
Network paths are often asymmetric — the route from A to B may differ from B to A. When diagnosing issues:
- Run
mtrfrom your machine to the target. - If possible, run
mtrfrom the target back to your public IP. - Compare both reports to identify whether loss or latency is on the forward or return path.
This is especially important when filing support tickets with hosting providers or ISPs.
7. Best Practices#
When to Use mtr#
Use mtr when:
pingshows loss/latency, buttraceroute(single path check) doesn’t reveal the issue.- Issues are intermittent (e.g., random disconnects).
Testing Duration#
For transient issues, run mtr for at least 100–1000 packets (-c 1000). Short tests (e.g., 10 packets) may miss problems.
Interpreting Loss Rates#
- Loss at local hops (first 1–2 hops) → Home/office network problem (e.g., Wi-Fi).
- Loss at intermediate hops (ISP, transit) → May be rate limiting; only a problem if loss carries through to the final hop.
- Loss at the final hop → End-to-end issue that likely affects application traffic.
- Run
mtrfrom both directions when possible to distinguish forward-path vs. return-path issues.
8. Limitations and Caveats#
- ICMP Blocking: Many routers/firewalls drop ICMP. A hop with 100% loss may just be blocking ICMP (not "down"). Use TCP/UDP mode to verify.
- Protocol Differences: ICMP (default) behaves differently from TCP/UDP. A server may block TCP SYN (e.g., port 80) but accept ICMP.
- Control Plane Rate Limiting: Intermediate hops often show high loss because routers deprioritize ICMP TTL-exceeded responses. This does not indicate actual packet forwarding loss — check whether the final hop also shows loss.
- Asymmetric Routing: Forward and return paths may differ. Loss at a specific hop could be on the return path, not at that hop itself.
- Load Balancers and Anycast: You may see different hops between runs if the destination uses load balancing or anycast routing.
- ICMP vs. Application Traffic: Routers may treat ICMP differently from TCP/UDP application traffic. A "clean"
mtrdoes not guarantee that application traffic experiences the same path quality.
9. References#
- Official
mtrRepository mtrMan Page:man mtr(Linux/macOS) — also available at man.archlinux.org- RFC 792 (ICMP)
- What is My Traceroute (MTR)? — Cloudflare
- How to properly interpret a traceroute or MTR — APNIC
- WinMTR (Windows)
By mastering mtr, you can diagnose complex network issues that traditional tools miss. Share your mtr reports with support teams to accelerate troubleshooting!