Learning to work with MTR command in Linux

One of the most important tasks in server management is network status monitoring. There are several tools for debugging and monitoring communications, one of the most powerful of which is MTR (My Traceroute). This tool helps the network administrator to identify errors and get a report of the general state of the network.

In this article, we have tried to deal with MTR, its production data, and how to analyze and interpret the information obtained from this tool.

An overview of how the main network debugging tools work #

Network debugging tools such as ping, traceroute, and MTR uses the Control Message Protocol (ICMP) to test communication and traffic between two points on the Internet. When pinging an IP, a number of ICMP packets are sent from the origin to the destination, and the destination responds by sending a number of ICMP packets to the origin.

Based on the exchange responses between these two points, the user can calculate the amount of round trip time (RTT) between these two points.

But tools like MTR and traceroute use the TTL (Time to Live) field in the IP packet header to calculate the number of steps (hop) in the path between source and destination.

The TTL specifies the number of steps a packet can go through before it expires. When using traceroute or MTR, to count the number of hops, several ICMP messages with the lowest value for TTL (value one) are sent first, and gradually the TTL value increases until it finally reaches the desired destination.

MTR can be a combination of ping and traceroute tools. In addition to providing an overview of the route that traffic travels from a source to a specific destination. this tool also provides more information about the status, communication, and response of hops.

How to install MTR? #

Unlike ping and traceroute tools, MTR is not installed by default on most systems. The following commands can be used to install this tool according to the type of operating system.

  • Ubuntu/Debian

sudo apt-get install mtr
  • CentOS/RHEL/Fedora

yum install mtr
  • Arch

pacman -S mtr
  • Windows

You can use WinMTR upstream software to install this tool on Windows operating system.

How to create a report by MTR #

Because MTR provides a view of the packet route from origin to destination, it can be considered a directional tool. The reciprocating routes of traffic between two points may not be the same, so it is recommended to use MTR on both sides when collecting communication problems between two points and collect the resulting information.

 

The simplest way we can use the MTR command is the following:

mtr example.com

The big advantage of MTR compared to traceroute is that we receive its output constantly so that we can see changes in network performance over time. Another way we can use MTR to generate a report is to:

mtr –report example.com

We can specify by adding the -n option to the mtr command for this tool to display the IP addresses of each hop instead of displaying them. For example, in the following command we use the MTR tool to report Google’s public DNS.

mtr - Learning to work with MTR command in Linux

MTR Report Example

The output of the MTR command report is as follows:

Host: Indicates the hostname or IP address of each step the packet went through.
Loss: Percentage of packet loss in each step
Snt: Number of packets sent
Last: Delay of the last packet sent in milliseconds
Avg: The average delay of all packets in milliseconds
Best: The minimum round trip time for a packet in milliseconds
Wrst: Maximum round trip time for a packet in milliseconds
StDev: standard deviation of delays for each

 

Powered by BetterDocs

Leave a Comment