We're an ISO27001:2013 Certified Supplier

When it comes to network performance troubleshooting, there are some long-standing tools that come to hand. Among the more popular are ping, which tests the ability of ICMP packets to get to and from a remote node, and traceroute, which will show the path those packets took through the network.

Both can be helpful when a remote node appears unreachable, although both tools rely upon the destination node and all intermediate nodes passing ICMP traffic (but that’s for another time).

It’s more challenging when a remote node is intermittently reachable, or the network connection to it appears unstable. If other nodes appear reachable, is the problem with remote node, or an intermediate router?

Enter mtr (“My traceroute”; originally “Matt’s traceroute”). This will show the route to the destination along with the packet loss and tround trip time at each step along the way. It will run continuously (until stopped by typing q). Here’s a sample output showing a very minor packet loss at one point (some hostnames/addresses have been shortened for readability):

$ mtr google.com
                     My traceroute  [v0.85]
awe (::)                                Tue Feb  7 08:41:59 2017

                         Packets               Pings
 Host                  Loss%   Snt   Last   Avg  Best  Wrst StDev

 1. 2001:8b0:..:39b     0.0%   277    0.5   0.4   0.2   0.6   0.0
 2. 2001:8b0:...::1     0.0%   277    0.8   0.6   0.4   0.8   0.0
 3. hex.aa.net.uk       0.0%   276   20.1  17.1  16.6  23.5   0.5
 4. 2001:7f8:4::50e8:1  0.0%   276   17.5  17.2  16.6  21.0   0.2
 5. 40ge1-3.core1...net 1.4%   276   24.1  24.1  17.2  66.4   9.5
 6. 2001:7f8:4::3b41:1  0.0%   276   18.2  18.1  17.5  29.7   1.1
 7. 2001:4860:0:1102::1 0.0%   276   19.1  18.9  18.3  21.6   0.3
 8. 2001:4860:0:1::1da9 0.0%   276   18.7  18.8  18.2  23.2   0.4
 9. lhr35s07-in-x0e...  0.0%   276   18.3  18.6  18.1  24.6   0.5

You can see minor packet loss (1.4%) at the fourth node along the route.

Highlight Slower Links

There are various options to change the display (try typing h while mtr is running). One useful toggle is the d key, which shows each successive ping as a separate character, and changes that character according to the round trip time. Here’s an example:

mtr

From the legend at the foot of the screen, we can see that the second hop has a round trip time (RTT) of sometimes under 1ms, sometimes just over. For the fifth hop, most RTTs are between 10ms and 15ms, but there’s one over 21ms.

Could This Linux Tip Be Improved?

Let us know in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *

Secure. Reliable. Scalable.

If that doesn't describe your current Linux systems, check out our FREE Linux Survival Guide to help you get your systems up to scratch today!

  • This field is for validation purposes and should be left unchanged.