Tutorial on how to use MTR network diagnostic tool for novices

888u

Last update at :2024-05-15,Edit by888u

MTR (My traceroute) is a network testing tool pre-installed in almost all Linux distributions. This tool also has a corresponding Windows version, named WinMTR. The MTR tool combines the functions of the ping and traceroute commands into the same tool to achieve more powerful functions. The Linux version of the mtr command sends ICMP packets for link detection by default. You can use the "-u" parameter to specify the use of UDP packets for detection. Compared with the traceroute command, which only performs a link tracking test once, the mtr command will continuously detect the relevant nodes on the link and give corresponding statistical information. Therefore, the mtr command can avoid the impact of node fluctuations on the test results, so its test results are more accurate, and it is recommended to be used first.

MTR is a classic network diagnostic tool commonly used for network troubleshooting. Simply put, it works by accessing a specified IP or domain name, listing its complete access link, sending ICMP packets to the link node, and determining the connection quality based on the response. MTR can be viewed as a network detection tool that combines traceroute and ping features.

As an example, if the local connection to the remote server is unstable and the network jitters. At this time, you can use MTR to find out where the problem lies, and then provide useful information for the relevant parties to solve.

MTR installation

Linux

Mainstream Linux distributions can install MTR through the system's own software source.

# Debian & Ubuntu
apt -y install mtr-tiny
#RHEL&CentOS
yum -y install mtr

If the software repository does not exist, you can download the MTR source code, compile and install it. Please check the official instructions for details.

https://github.com/traviscross/mtr

Windows

The software under Windows is called WinMTR. Its official website http://winmtr.net/ has long been closed, but it can be downloaded from third-party download sites.

https://sourceforge.net/projects/winmtr/files/

There is also a branch version that adds IPv6 support and some bug fixes.

https://github.com/White-Tiger/WinMTR

How to use MTR

If testing the outbound connection the MTR test server IP should be run on the local computer. If testing backhaul, operate on the server and test the local network public IP.

For most services, such as website or proxy usage, return quality should be more of a concern. Because the server mainly returns data to the local, and the amount of data sent locally to the server is very small.

The following will only talk about the usage of Linux MTR. The Windows graphical operation interface is very easy and will not be introduced.

For example, test the connection to 8.8.8.8. The r parameter in the command means to send 10 ICMP packets to the target host and then output a report. If there are no parameters, it will run continuously. To cancel, press the q key to exit.

mtr -r 8.8.8.8

Example output:

Start: Tue Feb 4 01:51:49 2020
HOST: localhost.localdomain Loss% Snt Last Avg Best Wrst StDev
1.|-- 64.52.23.1 0.0% 10 0.1 0.1 0.1 0.2 0.0
2.|-- 96.44.162.122.static.quad 0.0% 10 0.4 0.8 0.4 1.1 0.0
3.|-- colo-lax13.as8100.net 0.0% 10 0.9 3.5 0.2 32.3 10.1
4.|-- 204.152.204.18 0.0% 10 1.2 0.8 0.3 1.6 0.0
5.|-- 108.170.247.129 0.0% 10 1.4 1.4 1.3 1.6 0.0
6.|-- 108.170.234.215 0.0% 10 0.3 0.4 0.3 0.5 0.0
7.|-- dns.google 0.0% 10 0.3 0.3 0.2 0.3 0.0

Each numbered line in the report represents a hop, and the data packet reaches the destination host after passing through each hop. The first few hops are typically local ISP nodes, the next few are destination host ISP nodes, and the middle are network routing nodes.

The data columns in the report are described below.

  • Loss%: Packet loss rate (percentage);
  • Snt: Number of data packets sent;
  • Last: Latency of the latest packet (milliseconds);
  • Avg: average delay of sent packets (milliseconds);
  • Best: Minimum delay in sent data packets (milliseconds);
  • Wrst: Maximum delay in sent packets (milliseconds);
  • StDev: Delay deviation of sent data packets. The larger the delay deviation, the greater the delay fluctuation and the more unstable it is;

Introducing several common parameters of MTR.

If you do not want some hops to be displayed as domain names, add the n parameter to disable reverse DNS lookups so that the IP will always be displayed.

mtr -rn 8.8.8.8

If you need to specify the number of data packets to send, set it through the c parameter. For example, send 20 data packets (it will automatically exit after sending the data packets, so there is no need to add the r parameter).

mtr -c 20 8.8.8.8

The default packet sending interval is 1 second. If you want to speed up the delivery of packages, use the i parameter setting. For example, it is sent every 0.2 seconds (less than 1 second requires sudo to run with elevated privileges).

sudo mtr -ri 0.2 8.8.8.8

If you need to specify the packet size, use the s parameter. For example, set the data packet size to 128 bytes (if set to a negative number, the size of the data packet sent each time is random).

mtr -rs 128 8.8.8.8

Send UDP probe packets instead of default ICMP ECHO packets.

mtr -ru 8.8.8.8

MTR result analysis

MTR detection results mainly look at packet loss rate, average delay and delay deviation. Priority is given to the situation of the target host, which is the last hop. If there is no packet loss, the delay and fluctuation values ​​are within the normal range. Even if there is packet loss or timeout on the forward hop, it does not necessarily indicate a failure. It is possible to be affected by node ICMP rate limiting or dropped ICMP packets, especially if only individual hops are shown this way.

If packet loss occurs at multiple hops, and network congestion does not occur only during short-term peak hours, the quality of the target host will be affected. Then you need to contact the relevant party based on the packet loss node to solve the problem, usually either the local ISP or the server merchant.

Recommended site search: Guangzhou server, in domain name, free cloud host, registration-free CDN acceleration, high-defense US server, server, Korean server rental, website registration, independent IP space, foreign server rental price,

Tutorial on how to use MTR network diagnostic tool for novices

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码