Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
MTR – A Network Diagnostic Tool for Linux
MTR (My Traceroute) is a powerful network diagnostic tool that combines the functionality of traceroute and ping commands. It provides real-time network path analysis by sending packets to a target host and measuring round-trip times, packet loss, and latency at each hop along the route.
Unlike traditional traceroute tools that provide a one-time snapshot, MTR continuously monitors the network path, displaying live statistics in an interactive format. This makes it invaluable for diagnosing network performance issues, identifying bottlenecks, and troubleshooting connectivity problems in Linux environments.
How MTR Works
MTR sends a series of packets with incrementing TTL (Time To Live) values to discover each router hop between the source and destination. For each hop, it measures:
Packet Loss Percentage Shows reliability of each network segment
Round-Trip Time Statistics Including last, average, best, and worst response times
Host Information IP addresses and hostnames of intermediate routers
Jitter and Standard Deviation Indicates network stability
The tool displays results in real-time, allowing administrators to observe network behavior over time and identify intermittent issues that might be missed by single-run diagnostic tools.
Installation
Install MTR using your distribution's package manager:
# Ubuntu/Debian $ sudo apt install mtr # CentOS/RHEL (older versions) $ sudo yum install mtr # Fedora/CentOS/RHEL (newer versions) $ sudo dnf install mtr
Essential MTR Usage Examples
Basic Network Tracing
$ mtr google.com $ mtr 8.8.8.8
This launches interactive mode. Press q to quit or use Ctrl+C.
Numeric IP Display
$ mtr -n google.com
Shows only IP addresses without DNS resolution, reducing lookup delays.
Show Both Hostnames and IPs
$ mtr -b google.com
Report Mode with Limited Cycles
$ mtr -r -c 10 google.com $ mtr -rw -c 10 google.com > mtr-report.txt
The -r flag generates a summary report, while -w provides wide output format.
Custom Output Fields
$ mtr -o "LSDR NBAW JMXI" 8.8.8.8
Customize displayed columns (L=Loss%, S=Sent, D=Drop, R=Received, N=Hostname, etc.).
Adjust Packet Interval
$ mtr -i 2 google.com
Changes interval between packets from default 1 second to 2 seconds.
Alternative Packet Types
$ mtr --tcp example.com $ mtr --udp example.com
Use TCP SYN or UDP packets instead of ICMP for networks that block ICMP traffic.
Maximum Hops Limit
$ mtr -m 20 8.8.8.8
Limits maximum hops to 20 (default is 30).
Custom Packet Size
$ mtr -s 1024 -c 10 google.com
Tests with larger packet sizes to identify MTU-related issues.
Interpreting MTR Output
| Column | Description |
|---|---|
| Loss% | Percentage of packets lost at this hop |
| Snt | Number of packets sent |
| Last | Latency of the last packet (ms) |
| Avg | Average latency (ms) |
| Best | Best (lowest) latency (ms) |
| Wrst | Worst (highest) latency (ms) |
| StDev | Standard deviation of latencies |
Key Advantages
Real-time monitoring Continuous updates reveal intermittent issues
Comprehensive statistics More detailed than basic ping or traceroute
Multiple packet types ICMP, TCP, and UDP support
Flexible output Interactive mode and exportable reports
Network troubleshooting Identifies specific problem hops
Conclusion
MTR is an essential network diagnostic tool that provides comprehensive real-time analysis of network paths in Linux environments. Its combination of traceroute and ping functionality, along with continuous monitoring capabilities, makes it superior to traditional tools for identifying network performance issues and troubleshooting connectivity problems.
