Operations 10 min read

Mastering Linux Network Diagnostics with the mtr Command

This guide explains what the mtr (My Traceroute) tool does, its key features, how to install it on various Linux distributions, and provides detailed usage examples and option explanations for effective network latency and packet‑loss troubleshooting.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering Linux Network Diagnostics with the mtr Command

Overview

MTR (My Traceroute) combines the functionality of traceroute and ping to probe network paths, display each hop, and report round‑trip times (RTT) and packet loss in real time. It is valuable for network engineers and system administrators diagnosing latency or loss issues.

Key Features

Dynamic routing display : Continuously updates hop information instead of a single snapshot.

Packet type selection : Sends UDP by default, but can use ICMP Echo requests.

Latency and loss reporting : Shows RTT, loss percentage, and other statistics per hop.

Filtering and logging : Allows filters for specific routers and can save results to log files.

Protocol flexibility : Works over different protocols and ports.

Basic Usage

Syntax

mtr <target‑IP‑or‑hostname>

Help

mtr --help

Common Options

-r

: Report mode – send a fixed number of packets and then stop (e.g., -r 10). -c: Continuous mode – send packets indefinitely. -i: Interval between packets in seconds (default 1 s). -s: Packet size in bytes (default 50 B). -u: Use UDP instead of ICMP. -P: Set ICMP type (default type 8).

Output Explanation

The typical MTR table includes:

Host : IP address or hostname of the hop.

Loss% : Packet loss percentage at that hop.

Snt : Number of packets sent.

Last : RTT of the most recent packet.

Avg : Average RTT.

Best : Minimum RTT.

Wrst : Maximum RTT.

StDev : Standard deviation of RTT.

Command Examples

Basic test to www.example.com: mtr www.example.com Report mode (fixed 10 packets): mtr -r 10 www.example.com Set 1‑second interval between pings: mtr -i 1 www.example.com Show only IP addresses (no DNS lookup): mtr -n 8.8.8.8 Specify packet size (e.g., 1500 B) to test MTU: mtr -s 1500 www.example.com Force UDP probing: mtr -u www.example.com Save output to a file for later analysis: mtr www.example.com > mtr_output.txt Batch mode for parsable output: mtr -b www.example.com > output.txt Combine options (e.g., packet size 100 B, port 80):

mtr -s 100 -p 80 www.example.com

Installation

MTR is available in the default repositories of most Linux distributions.

Debian/Ubuntu: sudo apt-get install mtr Red Hat/CentOS: sudo yum install mtr After installation, running mtr --help confirms the tool is ready.

Sample Output

MTR output example
MTR output example
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

pingtraceroutemtrNetwork Diagnostics
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.