mtr (My Traceroute)

Installation:

# Debian/Ubuntu
sudo apt-get install mtr

# CentOS/RHEL
sudo yum install mtr

# macOS
brew install mtr

Basic Usage:

# Interactive mode
mtr google.com

# Report mode (run N cycles and exit)
mtr --report --report-cycles 10 google.com

# No DNS resolution
mtr -n google.com

# TCP mode (instead of ICMP)
mtr --tcp google.com

# UDP mode
mtr --udp google.com

# Specify port
mtr --tcp --port 443 google.com

# Wide report
mtr --report-wide google.com

Advanced Usage:

# CSV output
mtr --csv google.com

# JSON output
mtr --json google.com

# XML output
mtr --xml google.com

# Continuous with interval
mtr --interval 1 google.com

# Set packet size
mtr --psize 1000 google.com

# Set max TTL
mtr --max-ttl 20 google.com

# Both directions (requires cooperation)
mtr --both google.com

Reading mtr Output:

                             My traceroute  [v0.95]
host (192.168.1.100)                          2024-02-15T20:00:00+0000
Keys:  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    1.2   1.3   1.1   1.8   0.2
 2. 10.0.0.1                          0.0%    10    8.5   8.7   8.3   9.2   0.3
 3. 100.64.0.1                       10.0%    10   12.3  12.5  12.1  13.5   0.4
 4. 142.250.80.46                     0.0%    10   15.2  15.4  15.0  16.1   0.3

Key Columns:
- Loss%: Packet loss at this hop
- Snt: Packets sent
- Last: Last RTT
- Avg: Average RTT
- Best: Best RTT
- Wrst: Worst RTT
- StDev: Standard deviation (jitter)

Use Cases:

```bash

Find where packet loss occurs

mtr --report --report-cycles 100 example.com

Trace to specific port

mtr --tcp --port 443 example.com

Save report to file

mtr --report --report-cycles 50 example.com > mtr-report.txt

Monitor continuously

mtr --interval 1 --curses google.com

Quick 10-cycle report

mtr -r -c 10 example.com