Linux MTR Command: Combining Ping and Traceroute
The mtr (My Traceroute) command is a powerful network
diagnostic tool for Linux that unifies the capabilities of
ping and traceroute into a single utility.
While traditional tools provide static snapshots of network health,
mtr continuously probes the entire network path to a
destination host, offering real-time performance statistics for every
intermediate hop. This article explains how mtr functions,
why it bridges the gap between individual network utilities, and how to
utilize it effectively for network troubleshooting.
The Limitations of Ping and Traceroute
To understand the value of mtr, it helps to examine the
individual tools it replaces:
ping: Measures round-trip latency and packet loss between a source and a destination using ICMP Echo requests. While effective for determining whether an endpoint is reachable, it provides no visibility into the intermediary routers along the path.traceroute: Maps the exact sequence of hops (routers) that packets traverse to reach a destination. However, standard traceroute commands send only a few packets to each hop sequentially, providing a static, one-time view that often fails to capture intermittent packet loss, jitter, or temporary network congestion.
How MTR Combines Both Tools
The mtr utility integrates the route-discovery mechanism
of traceroute with the continuous polling behavior of
ping.
Upon execution, mtr first determines the route to the
target host by sending packets with incrementing Time to Live (TTL)
values. Once the path is established, it continuously sends ICMP, UDP,
or TCP packets to every router along that path simultaneously.
Instead of exiting after one pass, mtr dynamically
refreshes an interactive terminal interface, updating metrics for each
hop in real time. This ongoing polling allows administrators to
correlate packet loss or latency spikes at a specific intermediate node
with downstream performance degradation.
Key Metrics Provided by MTR
When running an mtr query, the output displays a
detailed statistical breakdown for each network hop:
- Host: The IP address or reverse DNS hostname of the router.
- Loss%: The percentage of packets dropped by that specific hop.
- Snt: The total number of packets sent.
- Last: The latency of the most recent probe (in milliseconds).
- Avg: The average round-trip time across all sent probes.
- Best: The lowest round-trip latency recorded.
- Wrst: The highest round-trip latency recorded.
- StDev: The standard deviation of the latency, which indicates network jitter and connection stability.
Common Usage and Practical Commands
The mtr tool offers several command-line flags to adapt
to different operational needs:
- Interactive Mode: Running
mtr <destination>launches the default real-time curses interface, which updates continuously until terminated. - Report Mode: Running
mtr -r -c 100 <destination>sends 100 packets to each hop and prints a clean, static summary table suitable for pasting into support tickets or documentation. - Displaying IP Addresses: The
-nflag prevents reverse DNS resolution, speeding up query times and displaying pure IP addresses. - Alternative Protocols: By default,
mtruses ICMP, but it can use TCP (--tcp -P <port>) or UDP (--udp) to bypass firewalls or test specific application ports.
By presenting a continuous, hop-by-hop evaluation of a network route,
mtr eliminates the guesswork of network diagnostics and
provides a comprehensive view of latency and packet loss across Linux
environments.