MTR(8)

๐Ÿ“ฆ version 0.96, in alpine 3.24

โœจ MTR(8) โ€” the network diagnostic tool โœจ

okay bestie, welcome to MTR(8) from the System Administration corner of the manual. This is the glow-up of a page about mtr, and honestly? it's iconic. Let's get into it ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

mtr โ€” a network diagnostic tool ๐Ÿซถ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

mtr [-4|-6] [-F FILENAME] [--report] [--report-wide] [--xml] [--gtk]
[--curses] [--displaymode MODE] [--raw] [--csv] [--json] [--split]
[--no-dns] [--show-ips] [-o FIELDS] [-y IPINFO] [--aslookup]
[--ipinfo_provider4 DOMAIN] [--ipinfo_provider6 DOMAIN] [-i INTERVAL]
[-c COUNT] [-s PACKETSIZE] [-B BITPATTERN] [-G GRACEPERIOD] [-Q TOS]
[--mpls] [-I NAME] [-a ADDRESS] [-f FIRST-TTL] [-m MAX-TTL]
[-U MAX-UNKNOWN] [-E MAX-DISPLAY-PATH] [--udp] [--tcp] [--sctp]
[-P PORT] [-L LOCALPORT] [-Z TIMEOUT] [-M MARK] HOSTNAME

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so here's the tea: mtr is literally traceroute and ping combined into one network diagnostic tool. Two queens, one app. periodt ๐Ÿ‘‘

When mtr starts up, it goes and investigates the network connection between the host it's running on and HOSTNAME by yeeting packets out with purposely low TTLs. Then it keeps sending those low-TTL packets, clocking the response time of every router in between. the way that works is: this is how mtr can print out the response percentage and response times of the whole internet route to HOSTNAME. And lowkey, a sudden spike in packet loss or response time is often a sign of a bad link โ€” or just a link that's overloaded, bestie, we've all been there ๐Ÿ˜ญ

The results usually show up as round-trip-response times in milliseconds, plus the percentage of packet loss. ๐Ÿ“Š


๐Ÿ’– OPTIONS ๐Ÿ’–

  • -h, --help โ€” prints the summary of command line argument options. the lil cheat sheet โœจ
  • -v, --version โ€” prints the installed version of mtr. like, which era of mtr are we even in ๐ŸŽ€
  • -4 โ€” use IPv4 only.
  • -6 โ€” use IPv6 only. (fun fact: IPV4 may be used for DNS lookups. so like, not fully exclusive ๐Ÿซฃ)
  • -F FILENAME, --filename FILENAME โ€” reads the list of hostnames from the specified file.
  • -r, --report โ€” this one puts mtr into report mode. when it's in this mode, mtr will run for the number of cycles specified by the -c option, and then print statistics and exit.

This mode is useful for generating statistics about network quality. but heads up bestie: note that each running instance of mtr generates a significant amount of network traffic. using mtr to measure the quality of your network may result in decreased network performance. so like, it's giving self-sabotage if you're not careful ๐Ÿ’€

  • -w, --report-wide โ€” puts mtr into wide report mode. in this mode, mtr will not cut hostnames in the report. no truncation, full name, main character energy ๐Ÿ‘‘
  • -x, --xml โ€” tells mtr to use the xml output format. this format is better suited for automated processing of the measurement results. robots love it ๐Ÿค–
  • -t, --curses โ€” forces mtr to use the curses based terminal interface (if available). in case the list of hops exceeds the height of your terminal, you can use the + and - keys to scroll up and down half a page.

Ctrl-L clears spurious error messages that may overwrite other parts of the display. a lil refresh moment โœจ

  • --displaymode MODE โ€” picks the initial display mode: 0 (default) selects statistics, 1 selects the stripchart without latency information, and 2 selects the stripchart with latency information. pick your fighter ๐ŸŽ€
  • -g, --gtk โ€” forces mtr to use the GTK+ based X11 window interface (if available). GTK+ must have been available on the system when mtr was built for this to work. see the GTK+ web page at http://www.gtk.org/ for more information about GTK+. a whole GUI vibe ๐Ÿฆ‹
  • -l, --raw โ€” use the raw output format. this format is better suited for archival of the measurement results. it could be parsed to be presented into any of the other display methods.

Example of the raw output format:

h 0 10.1.1.1
p 0 339
h 1 46.149.16.4
p 1 530
h 2 172.31.1.16
p 2 531
h 3 82.221.168.236
p 3 1523
h 5 195.130.211.8
p 5 1603
h 6 193.4.58.17
p 6 1127
h 7 193.4.58.17
d 7 www.isnic.is
  • -C, --csv โ€” use the Comma-Separated-Value (CSV) output format. (note: the separator is actually a semi-colon ;. yes really, it's giving "comma-separated" but make it a semicolon ๐Ÿ™ˆ)

Example of the CSV output format:

MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;1;r-76520-PROD.greenqloud.internal;288
MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;2;46.149.16.4;2086
MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;3;172.31.1.16;600
MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;4;82.221.168.236;1163
MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;5;???;0
MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;6;rix-k2-gw.isnic.is;1654
MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;7;www.isnic.is;1036
  • -j, --json โ€” tells mtr to use the JSON output format. this format is better suited for automated processing of the measurement results. Jansson library must have been available on the system when mtr was built for this to work. yes the Jansson library, it's a whole dependency situation
  • -p, --split โ€” sets mtr to spit out a format that is suitable for a split-user interface.
  • -n, --no-dns โ€” forces mtr to display numeric IP numbers and not try to resolve the host names. no names, just numbers, we love a no-nonsense moment ๐Ÿ”ข
  • -b, --show-ips โ€” tells mtr to display both the host names and numeric IP numbers. in split mode this adds an extra field to the output. in report mode, there is usually too little space to add the IPs, and they will be truncated. use the wide report (-w) mode to see the IPs in report mode. so if you're in report mode and your IPs are getting chopped, that's why ๐Ÿ’…
  • -o FIELDS, --order FIELDS โ€” specify which fields to display and in which order. you may use one or more space characters to separate fields.

Available fields:

  • 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

Example: -o "LSD NBAW X"

  • -y n, --ipinfo n โ€” displays information about each IP hop. valid values for n are:
    • 0 โ€” Display AS number (equivalent to -z)
    • 1 โ€” Display IP prefix
    • 2 โ€” Display country code of the origin AS
    • 3 โ€” Display RIR (ripencc, arin, ...)
    • 4 โ€” Display the allocation date of the IP prefix

It is possible to cycle between these fields at runtime (using the y key). yes queen, live field-switching, we stan a flexible UI โœจ

  • -z, --aslookup โ€” displays the Autonomous System (AS) number alongside each hop. equivalent to --ipinfo 0.

Example (columns to the right not shown for clarity):

1. AS???   r-76520-PROD.greenqloud.internal
2. AS51969 46.149.16.4
3. AS???   172.31.1.16
4. AS30818 82.221.168.236
5. ???
6. AS???   rix-k2-gw.isnic.is
7. AS1850  www.isnic.is
  • --ipinfo_provider4 DOMAIN โ€” provider for IPv4 AS lookups. defaults to origin.asn.cymru.com.
  • --ipinfo_provider6 DOMAIN โ€” provider for IPv6 AS lookups. defaults to origin6.asn.cymru.com.
  • -i SECONDS, --interval SECONDS โ€” specify the positive number of seconds between ICMP ECHO requests. the default value for this parameter is one second. the root user may choose values between zero and one. root only for the sub-second stuff, bestie, know your lane ๐Ÿ‘‘
  • -c COUNT, --report-cycles COUNT โ€” set the number of pings sent to determine both the machines on the network and the reliability of those machines. each cycle lasts one second. โฑ๏ธ
  • -s PACKETSIZE, --psize PACKETSIZE โ€” sets the packet size used for probing. it is in bytes, inclusive IP and ICMP headers.

If set to a negative number, every iteration will use a different, random packet size up to that number. chaos mode, love that for us ๐ŸŽฒ

  • -B NUM, --bitpattern NUM โ€” specifies bit pattern to use in payload. should be within range 0 - 255. if NUM is greater than 255, a random pattern is used.
  • -G SECONDS, --gracetime SECONDS โ€” specify the positive number of seconds to wait for responses after the final request. the default value is five seconds. ๐Ÿ•”
  • -Q NUM, --tos NUM โ€” specifies value for type of service field in IP header. should be within range 0 - 255.
  • -e, --mpls โ€” tells mtr to display information from ICMP extensions for MPLS (RFC 4950) that are encoded in the response packets. fancy protocol internals, we love a deep cut ๐ŸŒˆ
  • -I NAME, --interface NAME โ€” bestie, this one picks the network interface by name for sending out your probes ๐Ÿ’…. It's the moment when you've got multiple interfaces that both have routes to your destination (think wired Ethernet AND WiFi living their dual life) and you wanna test one specific one. Iconic for debugging "why is WiFi giving nothing but chaos".
  • -a ADDRESS, --address ADDRESS โ€” binds the outgoing socket to ADDRESS, so every packet goes out with ADDRESS as the source address โœจ. NOTE: this does not apply to DNS requests (which could be what you want, and could also absolutely not be what you want ๐Ÿ™ˆ).
  • -f NUM, --first-ttl NUM โ€” says what TTL to start at. Default is 1 ๐ŸŒฑ.
  • -m NUM, --max-ttl NUM โ€” the max number of hops (a.k.a. max time-to-live value) traceroute will probe. Default is 30 ๐Ÿš€.
  • -U NUM, --max-unknown NUM โ€” max unknown host. Default is 5 ๐Ÿ‘ป.
  • -E NUM, --max-display-path NUM โ€” the max number of ECMP paths to display. Default is 8 ๐Ÿ›ฃ๏ธ.
  • -u, --udp โ€” use UDP datagrams instead of ICMP ECHO ๐Ÿ“ฆ.
  • -T, --tcp โ€” use TCP SYN packets instead of ICMP ECHO. Heads up: PACKETSIZE gets ignored here, because SYN packets literally cannot contain data ๐Ÿšซ.
  • -S, --sctp โ€” use Stream Control Transmission Protocol packets instead of ICMP ECHO ๐ŸŒŠ.
  • -P PORT, --port PORT โ€” the target port number for TCP/SCTP/UDP traces ๐ŸŽฏ.
  • -L LOCALPORT, --localport LOCALPORT โ€” the source port number for UDP traces ๐Ÿ .
  • -Z SECONDS, --timeout SECONDS โ€” how many seconds to keep probe sockets open before giving up on the connection โณ. > Lowkey warning bestie: big values here, especially paired with a short interval, will eat up a lot of file descriptors ๐Ÿ˜ญ.
  • -M MARK, --mark MARK โ€” sets the mark for each packet sent through this socket, kinda like the netfilter MARK target but socket-based ๐Ÿท๏ธ. MARK is a 32-bit unsigned integer. See socket(7) for the full description of this socket option.

๐ŸŒธ ENVIRONMENT ๐ŸŒธ

mtr recognizes a few environment variables, and yes they're giving main character energy ๐Ÿ’–.

MTR_OPTIONS

This one lets you specify options as if they were passed on the command line ๐ŸŽ€. It's parsed before reading the actual command line options, so anything you put in MTR_OPTIONS gets overridden by command-line options. Sneaky, but make sense.

Example:

MTR_OPTIONS="-4 -c 1" mtr -6 localhost

would send one probe (because of -c 1) towards ::1 (because of -6, which overrides the -4 passed in MTR_OPTIONS) โœจ.

MTR_PACKET

A path to the mtr-packet executable, used for sending and receiving network probes ๐Ÿ“ก. If MTR_PACKET is unset, the PATH will be used to search for an mtr-packet executable ๐Ÿ”.

DISPLAY

Specifies an X11 server for the GTK+ frontend ๐Ÿ–ฅ๏ธ.


๐ŸŽฎ INTERACTIVE CONTROL ๐ŸŽฎ

mtr can be controlled while it's running with these keys, bestie:

 ?|h     help
 p       pause (SPACE to resume)
 d       switching display mode
 e       toggle MPLS information on/off
 n       toggle DNS on/off
 r       reset all counters
 o str   set the columns to display, default str='LRS N BAWV'
 j       toggle latency(LS NABWV)/jitter(DR AGJMXI) stats
 c <n>   report cycle n, default n=infinite
 i <n>   set the ping interval to n seconds, default n=1
 f <n>   set the initial time-to-live(ttl), default n=1
 m <n>   set the max time-to-live, default n= # of hops
 s <n>   set the packet size to n or random(n<0)
 b <c>   set ping bit pattern to c(0..255) or random(c<0)
 Q <t>   set ping packet's TOS to t
 u       switch between ICMP ECHO and UDP datagrams
 y       switching IP info
 z       toggle ASN info on/off
 q       exit

๐Ÿ’€ BUGS ๐Ÿ’€

Some modern routers give a lower priority to ICMP ECHO packets than to other network traffic ๐Ÿ˜ค. Consequently, the reliability of these routers reported by mtr will be significantly lower than the actual reliability of these routers. So likeโ€ฆ don't come for mtr, come for the router ๐Ÿ™ˆ.


๐Ÿซถ CONTACT INFORMATION ๐Ÿซถ

For the latest version, see the mtr web page at http://www.bitwizard.nl/mtr/ ๐ŸŒ

For patches, bug reports, or feature requests, please open an issue on GitHub at: https://github.com/traviscross/mtr ๐Ÿ™


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

mtr-packet(8), traceroute(8), ping(8), socket(7), TCP/IP Illustrated (Stevens, ISBN 0201633469) ๐Ÿ“š


And that's the whole page, bestie!! This was mtr version 0.96, chilling in section MTR(8) of your manual ๐Ÿ’–โœจ slay, go ping something, ily ๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from