Operations 10 min read

Master Linux Network Diagnostics with the mtr Command: A Complete Guide

This article provides a comprehensive overview of the Linux mtr tool, detailing its purpose, key features, installation methods, basic syntax, common options, output interpretation, and practical command examples to help network engineers and system administrators diagnose latency and packet loss effectively.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Network Diagnostics with the mtr Command: A Complete Guide

Overview of mtr

MTR (My Traceroute) combines traceroute and ping functionalities to probe network paths by sending ICMP or UDP packets, displaying each hop’s response time in real time. It helps network engineers and system administrators identify latency, packet loss, and overall connection quality.

Key Features

1. Dynamic Routing Display

Unlike traditional traceroute, MTR continuously updates the route status, making it useful for detecting transient network issues.

2. Packet Type Selection

By default MTR sends UDP packets, but it can be configured to use ICMP Echo requests, similar to the ping command.

3. Latency and Loss Reporting

MTR shows round‑trip time (RTT) for each hop and marks hops where packets are lost.

4. Filtering and Logging

Users can apply filters to focus on specific routers or network segments and optionally save diagnostic results to log files.

5. Network Probing Flexibility

MTR can operate over different protocols and ports to suit various testing requirements.

Basic Usage

1. Basic Syntax

Run mtr target_ip_or_hostname to start a live trace.

2. Help Information

Use mtr --help (or mtr -h) to display the full list of options.

3. Common Options

-r

: Report mode – send a specified number of packets and then stop (e.g., mtr -r 10 www.example.com). -c: Continuous mode – send packets indefinitely for ongoing monitoring. -i: Interval between packets in seconds (default 1 s). -s: Set packet size in bytes (default 50 B). -u: Use UDP instead of ICMP, useful when ICMP is blocked. -P: Choose ICMP type (default type 8).

Output Explanation

The typical MTR output includes columns such as:

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

1. Basic Trace

mtr www.example.com

2. Report Mode

mtr -r www.example.com

3. Set Ping Interval

mtr -w 1 www.example.com

4. Show IPs Only (no DNS)

mtr -d www.example.com

5. Limit Packet Count

mtr -c 10 www.example.com

6. Disable DNS Resolution

mtr -n 8.8.8.8

7. Adjust Packet Size

mtr -s 1500 www.example.com

8. Use UDP Probing

mtr -u www.example.com

9. Save Output to File

mtr www.example.com > mtr_output.txt

10. Batch Mode for Scriptable Output

mtr -b www.example.com > output.txt

11. Combine Multiple Options

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

(sets packet size to 100 B and probes port 80).

Installation

APT (Debian/Ubuntu)

sudo apt-get install mtr

YUM (Red Hat/CentOS)

sudo yum install mtr

Verification

After installation, run mtr --help to confirm the tool is available and view its usage information.

MTR help output
MTR help output
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.

networkdiagnosticsmtr
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.