MTR(8)
โจ 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 ofmtr. like, which era ofmtrare 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 putsmtrinto report mode. when it's in this mode,mtrwill run for the number of cycles specified by the-coption, 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โ putsmtrinto wide report mode. in this mode,mtrwill not cut hostnames in the report. no truncation, full name, main character energy ๐-x,--xmlโ tellsmtrto use the xml output format. this format is better suited for automated processing of the measurement results. robots love it ๐ค-t,--cursesโ forcesmtrto 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,1selects the stripchart without latency information, and2selects the stripchart with latency information. pick your fighter ๐-g,--gtkโ forcesmtrto use the GTK+ based X11 window interface (if available). GTK+ must have been available on the system whenmtrwas built for this to work. see the GTK+ web page athttp://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โ tellsmtrto 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 whenmtrwas built for this to work. yes the Jansson library, it's a whole dependency situation-p,--splitโ setsmtrto spit out a format that is suitable for a split-user interface.-n,--no-dnsโ forcesmtrto 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โ tellsmtrto 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 ratioDโ Dropped packetsRโ Received packetsSโ Sent PacketsNโ Newest RTT(ms)Bโ Min/Best RTT(ms)Aโ Average RTT(ms)Wโ Max/Worst RTT(ms)Vโ Standard DeviationGโ Geometric MeanJโ Current JitterMโ Jitter Mean/Avg.Xโ Worst JitterIโ 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 prefix2โ Display country code of the origin AS3โ 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 toorigin.asn.cymru.com.--ipinfo_provider6 DOMAINโ provider for IPv6 AS lookups. defaults toorigin6.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 range0-255. if NUM is greater than255, 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 range0-255.-e,--mplsโ tellsmtrto display information from ICMP extensions for MPLS (RFC 4950) that are encoded in the response packets. fancy protocol internals, we love a deep cut ๐-INAME,--interfaceNAME โ 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".-aADDRESS,--addressADDRESS โ 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 ๐).-fNUM,--first-ttlNUM โ says what TTL to start at. Default is1๐ฑ.-mNUM,--max-ttlNUM โ the max number of hops (a.k.a. max time-to-live value) traceroute will probe. Default is30๐.-UNUM,--max-unknownNUM โ max unknown host. Default is5๐ป.-ENUM,--max-display-pathNUM โ the max number of ECMP paths to display. Default is8๐ฃ๏ธ.-u,--udpโ use UDP datagrams instead of ICMP ECHO ๐ฆ.-T,--tcpโ use TCP SYN packets instead of ICMP ECHO. Heads up:PACKETSIZEgets ignored here, because SYN packets literally cannot contain data ๐ซ.-S,--sctpโ use Stream Control Transmission Protocol packets instead of ICMP ECHO ๐.-PPORT,--portPORT โ the target port number for TCP/SCTP/UDP traces ๐ฏ.-LLOCALPORT,--localportLOCALPORT โ the source port number for UDP traces ๐ .-ZSECONDS,--timeoutSECONDS โ 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 ๐ญ.-MMARK,--markMARK โ 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. Seesocket(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
- alpine 3.24: mtr-doc 0.96-r2 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms