YouTip LogoYouTip

Linux Comm Mtr

[![Image 1: Linux Command Encyclopaedia](#) Linux Command Encyclopedia](#)\n\n* * *\n\nmtr (My Traceroute) is a powerful network diagnostic tool that combines the functionality of `traceroute` and `ping`. It can display real-time data packet transmission paths in the network and provide detailed statistical information, making it an essential tool for network administrators and developers to troubleshoot network issues.\n\n### Main Features of mtr\n\n* **Real-time Updates**: Continuously displays routing and latency information\n* **Bidirectional Diagnosis**: Can display paths in both send and receive directions\n* **Comprehensive Statistics**: Provides key metrics such as packet loss rate and latency\n* **Visual Interface**: Interactive display of network path status\n\n* * *\n\n## Installing mtr Command\n\n### Installing on Common Linux Distributions\n\n## Example\n\n# Debian/Ubuntu Systems\n\nsudo apt-get install mtr\n\n# CentOS/RHEL Systems\n\nsudo yum install mtr\n\n# Fedora Systems\n\nsudo dnf install mtr\n\n# Arch Linux Systems\n\nsudo pacman -S mtr\n\n### Installing on macOS\n\n## Example\n\n# Using Homebrew\n\n brew install mtr\n\n* * *\n\n## mtr Basic Syntax\n\nThe basic syntax format for the mtr command is as follows:\n\nmtr target_host\n\n### Common Option Parameters\n\n| Option | Description |\n| --- | --- |\n| `-4` | Force IPv4 |\n| `-6` | Force IPv6 |\n| `-c COUNT` | Set the number of ping packets to send |\n| `-i SECONDS` | Set the ping interval (seconds) |\n| `-n` | Do not resolve hostnames, display IP addresses only |\n| `-r` | Report mode (non-interactive) |\n| `-s BYTES` | Set ping packet size (bytes) |\n| `-w` | Wide output mode, display full hostnames |\n| `-z` | Display AS (Autonomous System) numbers |\n| `--report` | Same as `-r`, generate report and exit |\n| `--report-wide` | Wide format report |\n\n* * *\n\n## mtr Usage Examples\n\n### Basic Usage: Diagnose network path to target host\n\nmtr google.com\n\nAfter execution, it will display a real-time updated interface containing the following information:\n\n* Hop count\n* Hostname or IP address\n* Packet loss percentage (Loss%)\n* Recent latency (Last)\n* Average latency (Avg)\n* Best latency (Best)\n* Worst latency (Wrst)\n* Standard deviation (StDev)\n\n### Generate Report Mode (suitable for script invocation)\n\nmtr -r -c 10 google.com > mtr_report.txt\n\nThis command will send 10 ping packets to google.com and save the results to the mtr_report.txt file.\n\n### Set ping packet size and interval\n\nmtr -s 100 -i 0.5 example.com\n\nThis command sets each ping packet size to 100 bytes with an interval of 0.5 seconds.\n\n### Display AS numbers simultaneously\n\nmtr -z example.com\n\nThis command will display the AS (Autonomous System) number for each node in the results, which helps identify network ownership.\n\n* * *\n\n## Understanding mtr Output\n\n### Interactive Interface Description\n\nWhen running mtr, you will see output similar to the following:\n\nMy traceroute [v0.92] example.com (192.0.2.1) 2022-01-01T12:00:00+0000Keys: Help Display mode Restart statistics Order of fields quit Packets Pings Host Loss% Snt Last Avg Best Wrst StDev 1. 192.168.1.1 0.0% 10 2.1 2.2 1.9 2.5 0.2 2. 10.0.0.1 0.0% 10 5.3 5.5 5.1 6.0 0.3 3. 203.0.113.1 0.0% 10 15.2 15.5 15.0 16.1 0.4 4. example.com 0.0% 10 20.1 20.3 20.0 21.0 0.3\n\n### Key Metrics Explained\n\n1. **Loss%**: Packet loss rate, higher values indicate a more unstable network\n2. **Snt**: Number of probe packets sent\n3. **Last**: Latency of the most recent probe (milliseconds)\n4. **Avg**: Average latency (milliseconds)\n5. **Best**: Best latency (milliseconds)\n6. **Wrst**: Worst latency (milliseconds)\n7. **StDev**: Standard deviation of latency, reflecting network stability\n\n* * *\n\n## Advanced Usage and Tips\n\n### 1. Track both IPv4 and IPv6 paths simultaneously\n\n## Example\n\nmtr -4 example.com # IPv4 path\n\n mtr -6 example.com # IPv6 path\n\n### 2. Use TCP SYN instead of ICMP (bypass certain firewalls)\n\nmtr --tcp example.com\n\n### 3. Specify source port (for specific routing tests)\n\nmtr --port 8080 example.com\n\n### 4. Save results to CSV format\n\nmtr --csv example.com > result.csv\n\n### 5. Compare network conditions at two time points\n\n## Example\n\nmtr -c 60-i 1-w example.com > result1.txt\n\n# After some time\n\n mtr -c 60-i 1-w example.com > result2.txt\n\ndiff result1.txt result2.txt\n\n* * *\n\n## Common Troubleshooting\n\n### 1. High packet loss rate issue\n\nIf you encounter high packet loss rate at a certain node:\n\n* The node may be overloaded\n* There may be a network device configuration issue\n* There may be an interconnection problem between ISPs\n\n### 2. Latency spike issue\n\nIf latency suddenly increases at a certain node:
← Linux Comm PgrepLinux Comm Dig β†’