Overview
mtr visually displays the network path from source to destination, continuously measuring and updating packet loss, latency, and response times for each hop. This allows for easy identification of network bottlenecks or problem areas.
Key Features
- Combines Ping and Traceroute functionalities
- Real-time network path diagnosis and updates
- Measures packet loss and latency for each hop
- Facilitates identification of network problem points
Key Options
The main options for the mtr command help you finely control the network diagnostic process.
Diagnostic Modes
Output Formats
Generated command:
Try combining the commands.
Description:
`mtr` Executes the command.
Combine the above options to virtually execute commands with AI.
Installation
mtr is not included by default in most Linux distributions and needs to be installed using the following commands.
Debian/Ubuntu
sudo apt update && sudo apt install mtr
Install mtr using the apt package manager.
CentOS/RHEL
sudo yum install mtr
Install mtr using the yum package manager.
Fedora
sudo dnf install mtr
Install mtr using the dnf package manager.
Usage Examples
Learn how to diagnose network issues with various usage examples of the mtr command.
Basic Usage
mtr google.com
Diagnose the network path to google.com in real-time.
Diagnose without Hostname Resolution
mtr -n google.com
Speed up diagnosis by displaying only IP addresses.
Report Mode (100 Packets)
mtr -r -c 100 google.com
Send 100 packets, then print results and exit.
Specify Packet Size (1000 Bytes)
mtr -s 1000 google.com
Diagnose the path using packets of 1000 bytes.
Specify Output Fields
mtr -o "LSD NBAW" google.com
Display fields for packet loss rate, sent packets, dropped packets, and latest/best/average/worst response times.
Tips & Notes
Helpful tips and notes for effectively using mtr to diagnose network problems.
Network Problem Diagnosis Tips
- **Check Packet Loss**: Consistently high 'Loss%' at a specific hop suggests a potential issue at that hop or further down the path.
- **Observe Latency Changes**: A sudden increase in 'Avg' (average latency) or a high 'StDev' (standard deviation) at a particular hop indicates latency issues at that point.
- **Diagnose DNS Issues**: Use the `-n` option to disable hostname resolution and see if the problem persists, helping to differentiate between DNS-related issues and network path problems.
- **Consider Firewall Impact**: Some routers or firewalls may limit or deprioritize ICMP packets. Therefore, 100% packet loss at a hop doesn't always definitively mean there's a problem with that specific hop.
Key Output Field Descriptions
Understanding what each field in the mtr output means can aid in diagnosis.
- Loss%: The percentage of packets lost at this hop.
- Snt: The total number of packets sent to this hop.
- Last: The latency (in ms) of the most recently received packet.
- Avg: The average latency (in ms) of all packets.
- Best: The shortest latency (in ms).
- Wrst: The longest latency (in ms).
- StDev: The standard deviation of latency. A high value indicates significant variation in latency.
Root Privileges Required
Some mtr functionalities (e.g., creating ICMP packets) may require root privileges. It is recommended to use `sudo mtr`.