How to use the mtr traceroute command on CentOS 8

s2 0

MTR is known as Matt’s traceroute. It is a simple, cross-platform network diagnostic utility that is used for most command line systems. This tool is not that popular, but it does offer the functionality of traceroute and ping programs. Similar to the traceroute program, the Mtr tool is also used to print the details about the desired route, e.g. B. How packets are initialized from the correct host and reach the destination of the specified host. The Mtr command displays more information than the Traceroute program, which determines the exact path between a local computer and a remote access system. It prints the percentage of the response rate and response time of all network hops that route between the host and target systems.

A network administrator needs to know how to use the mtr tool. The flags specified with the mtr command increase the productivity of network diagnostics. You can use these flags to customize the output you want. This article will show you how the mtr command can help you find the network analysis between the network hops on CentOS 8. The mtr tool is preinstalled by default in most Linux distributions. However, if it isn’t installed on your CentOS 8, you will need to install it first.

Install the mtr command on CentOS 8

  1. Press Ctrl + Alt + T to open Terminal, or open Terminal from the desktop, click the top corner of the Activities option and select Terminal from the options on the left sidebar.
  2. To install the mtr tool on CentOS 8 you need to log in as the root user. So enter the command ‘su’ on the terminal. You are now logged in as the root user.
  3. Run the following command on the terminal to install the mtr tool:
 $sudo yum install mtr

The Mtr tool has been successfully installed on your CentOS 8.0. Complete! “Status is displayed on the terminal.

How do I work with the mtr command?

There are the following ways to use the mtr command on the command line system.

  1. The mtr command provides the complete, real-time trace route report of a remote system. You must use the mtr command to specify the IP address or domain name of the remote system. Output will be displayed on the system to provide you with the updated real-time trace route report from the remote system. To exit the current program, press the “q” key or press “Ctrl + C” on your keyboard.

For example, take the domain name as bing.com in an argument with the mtr command. Run the following command to view the real-time traceroute report from bing.com:

Domain name

$mtr bing.com

or

IP address

$mtr 216.58.223.78

You can display a numeric IP address instead of the host name in the traceroute report. The -n flag with the mtr command is used to display numeric IP addresses. Run the following command in the terminal window to view the numeric IP addresses:

 $mtr -n bing.com

Show IP addresses in traceroute

If you want to display both IP addresses and the host name, use the -b flag with the mtr command. Run the following command to display both the host name and IP addresses in the traceroute report:advertising

$mtr -b bing.com

Show IP and host name

You can set a specific value to limit the number of pings with the mtr command. To do this, use the mtr command in conjunction with -C Flag and specified limit value. In this case, you have limited the number of pings to an exact value and should stop after this specified number of pings. You can see the exact number of pings below the “Snt column”. As soon as the number of pings reaches the specified limit, the real-time report updates the status of “Stops” and you will automatically exit the program. For easier understanding, run the following command on your terminal to perform the above process:

$mtr -c5 bing.com

Use the mtr command to set the reporting mode. In this case, report mode is activated, which shows the output in a text file. This method is useful for statistical network analysis. Because the output is printed to a text file, you can use these observations for future reference. To activate report mode, use -R Flag together with the -c flag option. You will also mention the specified ping limit with the -c flag and also provide the report name. The report name is basically the name of the report that will be saved after running the mtr command. Run the following command to complete the operation:

$mtr -r -c 5 bing.com > mtr-report

Save traceroute as a file

The above report is saved in the CentOS 8.0 home folder by default. You can also save a report to other drives on your system to provide the exact path to the saved location.

To use the -w and r flags with the mtr command, it enters report mode, which allows you to print clearer and more readable traceroute reports. Run the following command on the terminal to try this operation:

$mtr -rw -c 5 bing.com >mtr-report

By default, the mtr report is printed in a specific order. You can rearrange the report output fields the way you want to make the output more productive and useful.

To do this, you use Flag to rearrange the output. Run the following command in the Terminal window to rearrange the output:

$mtr -o "LSDR NBAW JMXI" 216.58.223.78

Format traceroute result

By default, the ICMP and ECHO requests have a time interval of 1 second. You can change this interval by changing the interval value. To set the new time interval, use the -I Flag with mtr command. Run the following command to see the output:

$mtr -i 2 bing.com

If you want to use packets from TCP SYN and UDP datagrams instead of ICMP ECHO requests, use TCP and UDP flags with the mtr command. Run the following command to perform the required operation:

$ mtr --tcp bing.com

OR

$ mtr --udp bing.com

Use udp for traceroute

By default, two hops have a time interval of 30 seconds. You can also define the maximum interval limit of two hops between the local computer and the remote system. Using -m Flag can change the default limit. Run the following command to try this operation on your CentOS 8.0:

$mtr -m 35 216.58.223.78

Set the trace route interval

Users can check the IP packet size and network quality. Using -S Flag allows you to change the packet size. Run the following command on the terminal to check the output:

$mtr -r -s PACKETSIZE -c 5 bing.com >mtr-report

The output is saved in the mtr report file.

You can also print the report output in XML format. XML is a better option to generate a report for automated processing. Run the following command to generate output in XML format:

$mtr --xml bing.com

Of all of the above commands, you can handle more mtr commands. To learn more about the mtr tool, you can run the following commands on the terminal:

$man mtr

or

$mtr --help

diploma

In the article above we learned how to use the mtr tool on the CentOS 8 command line. Additionally, we’ve examined various mtr commands that are so helpful to a network administrator. I hope this article will help you.

How to use the mtr traceroute command on CentOS 8