MTR Introduction

bow.sh 2026-01-28 1 views

MTR Introduction

mtr is a network testing tool pre-installed on almost all Linux distributions, standing for "my traceroute", used for network connectivity diagnostics. MTR combines the functionality of ping and traceroute commands into a single tool, providing more powerful capabilities. Unlike the traceroute command which performs only a single route trace test, mtr conducts continuous probing of relevant nodes along the path and provides corresponding statistics. Therefore, mtr can avoid the impact of node fluctuations on test results, making its connectivity testing more accurate.

MTR Parameter List

-F, --filename FILE        Read hosts to probe from file
-4                         Use IPv4 protocol only
-6                         Use IPv6 protocol only
-u, --udp                  Use UDP for path probing (mtr uses ICMP by default)
-T, --tcp                  Use TCP for path probing (mtr uses ICMP by default)
-a, --address ADDRESS      Set the IP address for sending packets (when a host has multiple IP addresses)
-f, --first-ttl NUMBER     Specify initial TTL, default is 1
-m, --max-ttl NUMBER       Specify maximum number of hops to probe
-U, --max-unknown NUMBER   Maximum number of unknown hosts, default is 5
-P, --port PORT            Destination port number (TCP, SCTP, UDP)
-L, --localport LOCALPORT  Source port number for UDP
-s, --psize PACKETSIZE     Specify packet size to send (in bytes)
-B, --bitpattern NUMBER    Specify bit pattern for payload
-i, --interval SECONDS     ICMP echo request interval
-G, --gracetime SECONDS    Seconds to wait for responses
-Q, --tos NUMBER           Specify Type of Service field value in IP header
-e, --mpls                 Display information from ICMP extensions
-Z, --timeout SECONDS      Specify timeout duration
-r, --report               Enable report mode (display statistics directly)
-w, --report-wide          Enable wide report mode (display full hostnames, suitable for long hostnames)
-c, --report-cycles COUNT  Set number of pings to send, default is 10
-j, --json                 Output in JSON format
-x, --xml                  Output in XML format
-C, --csv                  Output in CSV format
-l, --raw                  Output in raw format
-p, --split                Split output (concise mode)
-t, --curses               Use curses-based terminal interface
    --displaymode MODE     Select initial display mode (0: default with statistics, 1: bar chart without latency info, 2: bar chart with latency info)
-n, --no-dns               Do not attempt to resolve hostnames when displaying IP addresses
-b, --show-ips             Display both IP addresses and hostnames
-o, --order FIELDS         Specify fields to display
    Fields for -o option:
    L   Loss ratio
    D   Dropped packets
    R   Received packets
    S   Sent Packets
    N   Newest RTT (ms)
    B   Min/Best RTT (ms)
    A   Average RTT (ms)
    W   Max/Worst RTT (ms)
    V   Standard Deviation
    G   Geometric Mean
    J   Current Jitter
    M   Jitter Mean/Avg
    X   Worst Jitter
    I   Interarrival Jitter
-y, --ipinfo NUMBER        Select IP information output
-z, --aslookup             Print AS numbers
-h, --help                 Display help information
-v, --version              Display version information

Examples

# Use TCP mode with AS numbers, specify IPv4 protocol
mtr -rwzT4 google.com
# Output
HOST                                            Loss%   Snt   Last   Avg  Best  Wrst StDev
1. AS399804 45.59.126.1                          0.0%    10    1.2   1.2   1.1   1.5   0.1
2. AS53667  198.251.87.9                         0.0%    10    0.5   6.0   0.5  21.1   7.1
3. AS???    172.18.0.29                          0.0%    10    1.2   4.1   1.2  12.1   3.9
4. AS6939   100ge0-70.core3.lax2.he.net          0.0%    10    9.9  13.9   8.5  32.5   8.8
5. AS6939   port-channel8.core2.lax1.he.net      0.0%    10    8.9  15.7   8.2  46.4  12.1
    AS6939   100ge3-2.core1.lax2.he.net
6. AS???    google.as15169.any2ix.coresite.com   0.0%    10    9.8  13.8   8.5  32.9   7.4
    AS???    206.72.211.148.any2ix.coresite.com
    AS???    eqix-la1.google-2.com
7. AS15169  108.170.247.129                      0.0%    10    9.8   9.5   8.2  11.7   0.9
    AS15169  108.170.247.161
8. AS15169  142.251.60.127                       0.0%    10    8.3  15.9   8.3  38.1  10.4
    AS15169  142.251.60.129
9. AS15169  lax31s15-in-f14.1e100.net            0.0%    10    8.5  13.2   8.3  44.8  11.4

MTR Output Explanation

  • Column 1 (Host): Node IP address and domain name
  • Column 2 (Loss%): Node packet loss rate, packet loss rate at each hop
  • Column 3 (Snt): Number of packets sent. Default is 10, can be specified with -c parameter
  • Last, Avg: Latest latency and average latency of probes, in milliseconds. Generally focus on Avg (average latency)
  • Best, Worst: Minimum and maximum latency of probes, in milliseconds
  • StDev: Standard deviation; higher values indicate more instability at the corresponding node

Loss% (Packet Loss Rate)

If any node's packet loss rate is non-zero, it indicates potential network issues at that hop. Common causes of node packet loss include:

  • ISP limiting ICMP sending rate at the node for security or performance reasons, causing packet loss
  • The node actually experiencing anomalies, causing packet loss

You can determine the cause of packet loss by examining the loss pattern at the anomalous node and subsequent nodes:

  • If subsequent nodes show no packet loss, it typically indicates the anomalous node's packet loss is due to ISP policy restrictions. Such packet loss can be ignored.
  • If subsequent nodes also show packet loss, it typically indicates the anomalous node has actual network anomalies causing packet loss.
  • Additionally, both situations may occur simultaneously (node has both policy rate limiting and network anomalies). If the anomalous node and subsequent nodes show continuous packet loss with varying loss rates at different nodes, typically use the packet loss rate of the last few hops as the reference.

Sometimes mtr output shows ???, indicating no results found, which may also be due to ISP policy restrictions or timeouts.

Tags: mtr