Press "Enter" to skip to content

What is the MTR command, and how to use it?

What is the MTR command?

MTR command is a type of traceroute command developed by Matt Kimball in 1997 that allows both traceroute and ping in the same software. Originally the name MTR was an abbreviation of Matt’s traceroute, but in 1998, his colleague Roger Wolff worked on it too and changed the name to My traceroute.

Why is the MTR command better than the traditional Traceroute or Tracert?

The MTR command is better because it combines the Ping and the Traceroute command and gives additional information (statistics about time, packet loss, and round-trip time, too) about each hop on the way from the computer to the host.

MTR will send ICMP ECHOs (pings) and wait for them to return.

How can you get the MTR command?

To get it, you will need a few commands to download it and install it. You can do it on Ubuntu, other Linux distros, macOS, or BSD and its derivates. Sorry, but the command is not available on Windows.

Ubuntu

  1. Log in to your server, or start the Terminal application
  2. Write the command:

sudo apt update

this will update the list of all packages available

  1. Install with the following command:

sudo apt -y install mtr

macOS

  1. Open the Terminal app
  2. Install first the Homebrew with the following command:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

  1. Now, you can install the MTR command with:

brew install mtr

BSD

  1. Log into your server, or start the Terminal application
  2. Use the following command

pkg install mtr

You can install the MTR command on most Linux distros like Arch Linux, CentOS, Fedora, RedHat, Debian, and more.

Suggested article: What is Traceroute command and how to use it?

How to use the MTR command?

You can use it through the Terminal application. You have two basic ways to use the MTR command:

mtr + hostname – This one will show you the route to a particular hostname / domain name.

mtr +IP address – This will trace the route to a particular IP address. It could be IPv4 or IPv6 address.

The MTR syntax

mtr [-hvrctglspni46] [–help] [–version] [–report] [–report-cycles COUNT] [–curses] [–split] [–raw] [–no-dns] [–gtk] [–address IP.ADD.RE.SS [–interval SECONDS] [–psize BYTES | -s BYTES] HOSTNAME [PACKETSIZE]

But to see it more clearly, imagine it like this:

mtr OPTION OPTION’S VALUE hostname / IP address

  • mtr – my traceroute command.
  • OPTION – additional option for more precise probes. You can see the table below.
  • OPTION’S VALUE – sets the time or repetition. It depends on the option you have chosen. 
  • Hostname / IP address – You can put one of the two to trace the route to it.

We recommend you to read also about NSlookup command and DIg command

MTR command’s options

-h-helpHelp
-v-versionMTR’s version
-r-reportReport mode needs -c to specific the cycles before showing statistics at the end.
-w-report-wideExtended report mode.  
-c COUNT–report-cycles COUNTThe number of pings that must be sent.
-s BYTES–psize BYTES PACKETSIZEChoose the size of packets. If you chose a negative value, they would have a random size. 
-t–cursesCurses-based terminal interface
-n–no-dnsShow IP address, don’t resolve the hostname.
-g–gtkGTK+ interface.
-p–splitSplit-user interface.
-l–rawRaw output format. 
-a IP.ADD.RE.SS–address IP.ADD.RE.SSLink packets’ sockets to a specific interface
-i SECONDS–interval SECONDSSeconds between pings.
-u Use UDP.
-4IPv4 address only.
-6IPv6 address only.

The MTR command is a nifty tool for network diagnostic. Try it out! 

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *