Introduction
What is MTR?
My Traceroute (MTR) is a tool that combines traceroute and ping, which is another common method for testing network connectivity and speed.
MTR shows constantly updating information about the latency and packet loss along the route to the destination. It is a network diagnostic tool that continuously sends packets showing the ping time for each hop. It also displays network problems of the entire route taken by the network packets.
MTR is not installed by default on most systems. You can get it installed by the following commands in different OS.
Ubuntu/Debian OS:
sudo apt-get install mtr
CentOS/Fedora OS:
yum install mtr
Examples of the use of the MTR command:
1. View the traceroute report
Syntax: mtr [domainName/IP]
mtr idrivecompute.com
The output of the command:
2. Report Mode:
Run mtr with the--report
option, which returns the results of sending 10 packets to each hop.
mtr --report idrivecompute.com
3. Specify a limit for the number of pings
You can configure the mtr command to quit after printing the traceroute report for a specific number of pings.
Syntax: mtr-c [n] “domainname/IP"
mtr -c 20 idrivecompute.com
Output: You can view the number of pings under the Snt column; when Snt reaches the number (20) specified in your command through the c flag, mtr will automatically exit.
4. Use TCP and UDP commands:
To get the details of the TCP and UDP network, use --tcp and --udp flags.
Syntax:
mtr –tcp “domainName/IP”
mtr –udp “domainName/IP”
mtr --tcp idrivecompute.com
mtr --udp idrivecompute.com
5. Using MTR to print CSV Output
The mtr command can support the CSV format for printing traceroute reports and delimits the columns with a “,”. With the --csv flag, you can customize the mtr command to output the report.
Syntax: mtr –csv “domainName/IP”
mtr --csv idrivecompute.com
Output:
6. Using MTR to print XML Output
The mtr command can also support the XML format for printing traceroute reports.
Syntax: mtr –xml “domainName/IP”
mtr --xml idrivecompute.com
Output:
Further options for usage and customization of the mtr command by reading its help and man page through the following commands or refer to the following link here
man mtr