How to use MTR in Windows and/or Linux?
The following method works on Mevspace's (formerly Skynode) dedicated servers.
What is MTR?
MTR stands for My Traceroute/Matt’s Traceroute. It's a tool used for network diagnostics: it analyzes quality and efficiency of network traffic. It works using features of ping and Tracerouters programs.
Use of MTR in the system Windows
Caution: In order to use MTR you have to get a proper software. In case of Windows it's WinMTR.
It's best to run the program as administrator (click with mouse right button - "Run as Administrator").
Legend:
Interval (sec) – Intervals between packet sendings, expressed in seconds.
Ping size (bytes) – Size of each packet, expressed in bytes.
Max. hosts in LRU list – Maximum amount of hosts on the Least Recently used list.
Resolve names – After this option has been unchecked, hosts' IPs will be shown instead of their names.
After the test has begun you will see:
Hostname - domain name or IP of next router in the network,
Nr - next router or host in the way your data was sent,
Loss% - percent of losses on given jump,
Sent - amount of packets (pings) sent,
Recv - amount of packets (pings) received,
Best - best ping,
Avrg - average ping,
Worst - worst ping,
Last - last response.
Saving .txt file
Saving .html file
.txt result file
.html result file
Using MTR in the system Linux
By default, MTR is installed in most of Linux distributions. It can be installed using the packet manager, with packet names as follows:
Red Hat/CentOS/Fedora/SuSE: mtr (CLI - Command Line), mtr-gtk (graphic interface version)
Debian/Ubuntu: mtr-tiny (CLI - Command Line), mtr (graphic interface version)
Arch: mtr (CLI - Command Line), mtr-gtk (graphic interface version)
Program operation
The program is ran using the command line, with host/domain name/IP as a parameters.
This mtr command syntax displays host names in traceroute report.
Syntax:
$ mtr [domain name / IP]
The basic use of MTR program is browsing a traceroute report of a remote computer.
$ mtr google.com
My trace route [v0.92]linux (192.168.100.4) 2018-12-06T09:25:20+0500Keys: Help Display mode Restart statistics Order of field quitPackets PingsHost Loss% Snt Last Avg Best Wrst StDev1. _gateway 0.0% 100 0.5 0.5 0.4 1.7 0.12. 58-65-175-240.nayatel.pk 0.0% 100 2.7 3.0 2.3 21.4 2.2
After you're done browsing the report, you can leave this command by pressing either q or Control + C shortcut.
Display numerical IP addresses instead of hostnames
If you use -g flag (flag - a parameter of a command expressed in a dash and letter or letters, e.g. -Syu) in the mtr command, the program will display numerical IP addresses instead of hostnames in the traceroute report.
Syntax:
$ mtr -g [domain name / IP]
Example:
$ mtr -g google.com
My trace route [v0.92]linux (192.168.100.4) 2018-12-06T09:28:09+0500Keys: Help Display mode Restart statistics Order of field quitPackets PingsHost Loss% Snt Last Avg Best Wrst StDev1. 192.168.100.1 0.0% 18 0.5 0.5 0.4 0.6 0.02. 58.65.175.240 0.0% 18 11.0 5.2 2.5 40.6 9.0
Using both hostnames and numerical IP addresses
After using -b flag with the mtr command, both numerical IP address and hostnames of testes hosts will be displayed in the report.
Syntax:
$ mtr -b [domain name / IP]
Example:
$ mtr -b google.com
My trace route [v0.92]linux (192.168.100.4) 2018-12-06T09:30:52+0500Keys: Help Display mode Restart statistics Order of field quitPackets PingsHost Loss% Snt Last Avg Best Wrst StDev1. _gateway (192.168.100.1) 0.0% 13 0.5 0.5 0.4 0.7 0.12. 58-65-175-240.nayatel.pk (58.65. 0.0% 13 2.5 2.6 2.3 2.7 0.1
Setting up the maximum amount of pings sent
You can configure the mtr command in a way it will display the traceroute report for a certain number of pings. In the output you will easily see the amount of pings in the Snt column; when Snt will reach the amount declared with the -c flag, mtr will terminate.
Syntax:
$ mtr -c [n] [domain name / IP]
Example:
$ mtr -c 10 google.com
Write the MTR report to a .txt file
Instead of printing output data of mtr command in the command line, you can enable the report mode, which instead will write the output to a text file. In this way, you can save the network analysis for later use and observation.
All you need to do is enable the report mode with the -r flag, specify the amount of pings with the -c flag and specify the name of the report file.
Syntax:
$ mtr -r -c [n] [domain name / IP] > report-name
Example:
$ mtr -r -c 10 google.com >mtr-report-google
By default, the report is written to home directory of current user. However, you can specify your own path for the file.
Syntax:
$ mtr -r -c [n] [domain name / IP] > /specified-folder/report-name
Full hostnames in the report
Using -w flag along with r flag will make mtr print and save more readable report by displaying full hostnames in the report.
Syntax:
$ mtr -rw -c [n] [domain name / IP] > report-name
Example:
$ mtr -rw -c 10 google.com > report-google
Output fields order change
While analyzing MTR report, you'll notice that the columns have a default arrangement. Using -o flag will allow you to change it in a way it'll be more clear and useful to you.
Syntax:
$ mtr -o [output format] [domain name / IP]
MTR user manual page can help you choose the column arrangement options.
Example:
$ mtr - "LSDR NBAW JMXI" google.com
(Uppercase letters come from column name's first letter. You can learn more about it using $ man mtr and $ mtr --help commands)
My trace route [v0.92]linux (192.168.100.4) 2018-12-06T09:49:25+0500Keys: Help Display mode Restart statistics Order of field quitPackets PingsHost Loss% Snt Drop Rcv Last Best Avg Wrst Jttr Javg Jmax Jint1. _gatew 0.0% 75 0 75 0.4 0.4 0.5 0.6 0.0 0.0 0.2 0.72. 58-65- 0.0% 75 0 75 2.7 2.4 3.3 24.7 0.1 1.5 22.2 42.1
Set time between ICMP ECHO requests (time between sending and receiving every packet)
Caution: Even though the default time between ICMP ECHO is 1 second in the MTR command, you can change it using -i flag and set up the new time window.
Syntax:
$ mtr -i [time in seconds] [domain name / IP]
Example:
$ mtr -i 10 google.com
Setting up packet size
Using -s flag allows specifying the size of IP packets sent, expressed in bytes, to diagnose the network quality.
Syntax:
$ mtr -r -s [packet size ] [domain name / IP]
Example:
$ mtr -r -s 50 google.com
Displaying MTR raport as CSV
Output data in MTR report is separated in columns with "," character. Using -csv flag allows customizing MTR command, so it displays the report in CSV format.
Syntax:
$ mtr --csv [domain name / IP]
Example:
$ mtr --csv google.com
sana@linux: ~$ mtr --csv google.comMtr_Version,Start_Time,Status,Host,Hop,Ip,Loss%,Snt, , Last,Avg,Best,Wrst,StDev,MTR.0.92,1544074674,OK,google.com,1,_gatewy,0.00,10,0,0.64,0.69,0.63,0.89,0.08MTR.0.92,1544074674,OK,google.com,2,58-65-175-240.nayatel.pk,0.00,10,0,2.88,2.81,2.65,2.97,0.10MTR.0.92,1544074674,OK,google.com,3,???,100.00,10,10,0.00,0.00,0.00,0.00,0.00MTR.0.92,1544074674,OK,google.com,4,???,100.00,10,10,0.00,0.00,0.00,0.00,0.00MTR.0.92,1544074674,OK,google.com,5,???,100.00,10,10,0.00,0.00,0.00,0.00,0.00
Display MTR report as XML
MTR command can also display traceroute reports in XML format. It is useful in automated output data analysis and can be used with -xml flag.
Syntax:
$ mtr --xml [domain name / IP]
Example:
$ mtr --xml google.com
sana@linux: ~$ mtr --xml google.com<?xml version="1.0"?><MTR SRC="linux" DST="google.com" TOS="0x0" PSIZE="64" BITPATTERN="0x00" TESTS="10"><HUB COUNT="1" HOST="_gateway"><Loss> 0.0%</Loss><Snt> 10</Snt><Last> 0.7</Last><Avg> 1.1</Avg><Best> 0.6</Best><Wrst> 4.3</Wrst><StDev> 1.1</StDev></HUB><HUB COUNT="2" HOST="58-65-175-240.nayatel.pk"><Loss> 0.0%</Loss><Snt> 10</Snt><Last> 2.7</Last><Avg> 4.0</Avg><Best> 2.7</Best><Wrst> 9.7</Wrst><StDev> 2.3</StDev></HUB><HUB COUNT="3" HOST="???"><Loss> 100.0%</Loss><Snt> 10</Snt><Last> 0.0</Last><Avg> 0.0</Avg><Best> 0.0</Best><Wrst> 0.0</Wrst><StDev> 0.0</StDev></HUB>
Access MTR help and user manual page
More options for using and customising MTR command can be found by reading help page and user manual, which can be accessed with following commands:
$ man mtr
$ mtr --help
Described above is the more advanced way of using the MTR command in Linux, through the command line. However, MTR also has graphical interface that can be download with commands described at the beginning of this article.
In order to run MTR command in graphical mode in command line we need to use following command:
Syntax:
$ xmtr [domain name / IP]
Example:
$ xmtr google.com