In today’s guide, we are going to look at the mtr command and see what it can tells us about network connections. Mtr is a simple linux command line tool that you can use for network diagnostic and troubleshooting in linux. It comes with the options of both ping and traceroute commands. Just like a typical traceroute query, a query from the MTR command will show the route from a computer to a specified host.
The advantage over using the ping and traceroute commands is that Mtr will provide a lot of statistics about each hop, like response time and percentage.
This tool comes pre-installed on most of the linux distros. However you can also install it manually using the following command.
Step 01 : Installation
#sudo apt install mtr
Step 02 : Get the basic report
To get the basic traceroute report using Mtr, run the following command
#sudo mtr <domain_name/ip_address>
Step 03 : view the numeric IP addresses
You can use the -g option with mtr command to view the numeric IP addresses instead of the hostnames in the traceroute report.
#sudo mtr -g < domain_name/ip_address>
Step 04 : Manually set the number of pings
you can manually set the number of pings that you want to send using -c option
#sudo mtr -c <number_of_pings> <domain_name/ip_address>
Step 05 : print the output to a text file
If you need to print the output of mtr command to a text file, you can do that by using the -r flag
#sudo mtr -r < domain_name/ip_address> > <output_file_name>
By default, this file will be saved in the user’s home folder
Step 06 : Specify the ICMP time interval
The default interval between ICMP ECHO requests is one second. You can specify the time interval between ICMP echo requests using the -I flag
#sudo mtr -I <time_in _seconds_> < domain_name/ip_address>
Step 07 : Use TCP SYN packets or UDP datagrams
You can use TCP SYN packets or UDP datagrams instead of the default ICMP ECHO requests using the following command
#sudo mtr --tcp < domain_name/ip_address>
Or
#sudo mtr --udp < domain_name/ip_address>
Step 08 : Specify the maximum number of hops manually
The default maximum number of hops to be probed between the local system and the remote machine is set to 30. You can specify the maximum number of hops manually by using the following command
#sudo mtr -m <number_of _hops> < domain_name/ip_address>
Latest posts by Ruwantha Nissanka (see all)
- 4 ways to hide your identity using linux - January 18, 2021
- How To Install Kali Linux in Virtualbox - December 31, 2020
- Kali Linux : The OS That Hackers Use - December 31, 2020
- How to monitor user activity in Linux with Acct - December 30, 2020
- Debsecan : You will not miss another security update - December 28, 2020