MTR Command Guide
The MTR command is an indispensable network
diagnostic tool that merges the functionalities of
traceroute and ping. It provides real-time
network statistics, helping you diagnose network latency, packet
loss, and identify the path packets take to a destination. This
guide covers essential MTR commands and their usage.
Understanding MTR Network Diagnostics
MTR (My Traceroute) continuously sends packets to a target host and displays the results in real-time. This allows for dynamic monitoring of network performance across different hops. It's crucial for identifying bottlenecks and understanding where network issues might be occurring.
Core MTR Command Usage
# mtr
# Network diagnostic tool that combines the functions of traceroute and ping.
# Basic usage to diagnose a network path
mtr hostname_or_ip
Advanced MTR Command Options
Controlling MTR Cycles and Reporting
# Run mtr with a specific number of cycles (useful for getting a quick snapshot)
mtr -c 10 hostname_or_ip
# Run mtr in report mode, providing a summary after a set number of cycles
mtr --report hostname_or_ip
# Run mtr in a mode suitable for scripting, exiting after a given number of cycles
mtr --report-cycles 10 hostname_or_ip
Improving Accuracy and Network Protocol Usage
# Run mtr as root to use ICMP ECHO for improved accuracy
sudo mtr hostname_or_ip
# Use TCP instead of ICMP ECHO (useful for environments with ICMP restrictions)
mtr --tcp hostname_or_ip
Customizing Packet Parameters
# Set the interval between packets sent (default is one second)
mtr --interval 0.5 hostname_or_ip
# Run mtr with a specified packet size
mtr --psize 1500 hostname_or_ip
# Limit mtr to testing a specific number of hops
mtr --max-ttl 10 hostname_or_ip
Output and Display Options
# Display both IP address and hostname
mtr --show-ips hostname_or_ip
# Run mtr with JSON output (useful for machine parsing)
mtr --json hostname_or_ip
External Resources for Network Diagnostics
- MTR Manual Page - Official documentation for the MTR command.
- What is Traceroute? - Cloudflare's explanation of traceroute functionality.
- MDN Network Information API - For web-based network information.