June 2, 2009

MTR – The Network Diagnostic Swiss Army Knief

MTR, a Linux shell command, combines the functionality of the ‘traceroute’ and ‘ping’ programs in a single network diagnostic tool.

When MTR starts, it investigates the network connection between the host MTR runs on and HOSTNAME (e.g. www.google.com), by sending packets with purposly low TTLs. It continues to send packets with low TTL’s, noting the response time of the transit routers. This allows MTR to print the response percentage and response times of the internet route to the remote host. A sudden increase in packetloss or response time is often an indication of a problematic or saturated link.

Compared to mixing and matching ping and traceroute commands, MTR is a true network diagnostic swiss army knief. For those bound to Windows destkops, Microsofts command link “pathping” is similar to MTR but lacks the real time tracing and statistical data.

MTR Example:

[shell][root@v ~]# mtr www.google.com

My traceroute  [v0.71]

uber.server (0.0.0.0)                                 Tue Jun  2 23:49:02 2009
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
Packets               Pings
Host                                       Loss%  Last   Avg  Best  Wrst StDev
1. core-rtr1.md3v.net                     0.0%   0.6   0.5   0.5   0.6   0.0
2. wan-r222-mdc-gi0-csl.md3v.net      0.0%  13.4  14.1  13.4  18.0   1.7
3. ge-0-1-CT99.ntt.net                0.0%  13.7  26.0  13.5 100.3  32.7
4. 299.1.45.161                             0.0%  13.4  13.7  13.4  15.0   0.6
5. 299.1.45.230                             0.0%  13.6  13.6  13.5  13.9   0.2
6. 299.183.136.77                           0.0%  53.0  53.0  52.9  53.2   0.1
7. 202.183.136.82                           0.0%  53.3  53.1  53.0  53.3   0.1
8. 202.183.136.98                           0.0%  53.1  53.0  52.9  53.2   0.1
9. 209.85.243.156                           0.0%  53.5  53.5  53.3  53.8   0.1
10. 209.85.241.217                           0.0%  83.1  83.2  83.1  83.3   0.1
11. 66.249.94.34                             0.0%  89.3  87.9  83.2  93.6   4.3
66.249.94.6
12. hk-in-f99.google.com                     0.0%  83.4  83.2  83.1  83.4   0.1
[/shell]

Note: IP addresses are obscured to protect the innocent 😐

Definitions:

Time To Live, the number of seconds remaining on a cached record before it is purged. For authoritative records the TTL is fixed at a specific length. If a record is cached, the server providing the record will provide the time remaining on the TTL rather then the original length it was given.