MTR (My Traceroute) is a command-line network diagnostic tool that combines the functionalities of the ping and traceroute commands. It offers a streamlined and cross-platform approach, providing comprehensive insights into the route network packets take from the host system to a specified destination. What sets MTR apart is its ability to include response percentages and times for every network hop, making it a valuable tool for network administrators seeking thorough diagnostics.
Installing MTR on Ubuntu
If MTR is not pre-installed on your system, you can easily install it using the following apt command:
sudo apt install mtr
Usage of the mtr Command
1. View Real-time Traceroute Report
Use the MTR command to display a real-time traceroute report for a remote machine. Simply input the domain name or IP address, and MTR will generate the report on the fly.
Display Numeric IP addresses:
mtr -g google.com
Use both hostnames and numeric IP addresses:
mtr -b google.com
2. Specify a Ping Limit
Configure MTR to terminate after a specific number of pings, providing a concise traceroute report.
mtr -c 10 google.com
3. Enable Report Mode
Instead of displaying results on the screen, use report mode to save the output in a text file.
mtr -r -c 10 google.com > mtr-report-google
4.Specify Time Interval between ICMP ECHO Requests
Adjust the time interval between ICMP ECHO requests by using the -i flag.
mtr -i 10 google.com
5. Utilize TCP SYN Packets or UDP Datagrams
Choose between TCP SYN or UDP datagrams for MTR requests, deviating from the default ICMP ECHO.
mtr --tcp google.com
mtr --udp google.com
6. Specify Packet Size
Tailor the size of the IP packet for network quality diagnosis using the -s flag.
mtr -r -s 50 google.com
For additional options and customization details, refer to the MTR command’s help and man page:
you can get further options for usage and customization of the mtr command by reading its help and man page through the above commands.