9.5 MTR

Matt's traceroute (MTR) is a newer version of traceroute that combines the functionality of traceroute and ping in a single interactive session. If your system will support it, it will even use a fancy graphical interface to display its results.

9.5.1 Installing MTR

MTR is available from http://www.bitwizard.nl/mtr/. It will build easily on Linux:

 
 Linux% gunzip -c mtr-0.53.tar.gz  tar xvf -    Linux% cd mtr-0.53    Linux% ./configure    Linux% make 

But Solaris will be a bit more trouble. First, Solaris does not come installed with the ncurses package, which is required by MTR. You can download it from http://www.gnu.org/ and it should build cleanly:

 
 Solaris% gunzip -c ncurses-5.3.tar.gz  tar xvf -    Solaris% cd ncurses-5.3    Solaris% ./configure    Solaris% make 

Then set the CFLAGS and LDFLAGS environment variables appropriately before configuring MTR. If you use the bash, Korn, or Bourne shell, [8] it will be something like:

[8] The Bourne shell is /bin/sh .

 
 Solaris% CFLAGS=-I/var/tmp/ncurses-5.3/include export CFLAGS    Solaris% LDFLAGS=-L/var/tmp/ncurses-5.3/lib export LDFLAGS 

But if you use csh or tcsh it will be:

 
 Solaris% setenv CFLAGS -I/var/tmp/ncurses-5.3/include    Solaris% setenv LDFLAGS -L/var/tmp/ncurses-5.3/lib 

In either case, the path should correspond to wherever you built the ncurses package.

Now you may configure and build MTR:

 
 Solaris% gunzip -c mtr-0.53.tar.gz  tar xvf -    Solaris% cd mtr-0.53    Solaris% ./configure    Solaris% make 

But it will likely fail at the last step because of a bug in the way MTR configures for Solaris. You can work around the problem as follows . Type:

 
 Solaris% make >! /var/tmp/buildlog 

Then open the file /var/tmp/buildlog in an editor. There will be a few lines, one much longer than the rest:

 
 make  all-recursive    Making all in img    cc  -I/var/tmp/ncurses-5.3/include/ -L/var/tmp/ncurses-5.3/lib/...    *** Error code 1    *** Error code 1    *** Error code 1 

Remove every line except for the one long line. Then, at the very end of that line, leave a space and append the text -lncurses so that the end of the line looks something like:

 
 ...-lm -ltermcap -lncurses 

Now save the file, and execute:

 
 Solaris% source /var/tmp/buildlog 

When it is complete, there should be an executable file named mtr in the directory, indicating that the build was successful.

9.5.2 Using MTR

Just like traceroute, MTR requires root privileges to run correctly. You can either install MTR with setuid root privileges or simply run MTR from a root account.

Here is a capture of a text-based interactive session, which was started with the command mtr -t www.example.com on workstation1.mit.edu :

 
 Matt's traceroute  [v0.52]    workstation1.mit.edu                                    Tue Feb 25 18:41:58 2003    Keys:  D - Display mode    R - Restart s    Packets Pings Hostname                                 %Loss  Rcv  Snt  Last Best  Avg  Worst     1. ROUTER1.MIT.EDU                         0%    5    5     0    0    0      0     2. EXTERNAL-RTR-2-BACKBONE.MIT.EDU         0%    5    5     0    0    0      0     3. p4-0.bstnma1-cr5.bbnplanet.net          0%    4    4     0    0    0      0     4. so-4-3-0.bstnma1-nbr2.bbnplanet.net     0%    4    4     0    0    0      0     5. p9-0.nycmny1-nbr2.bbnplanet.net         0%    4    4     6    6    6      6     6. p15-0.nycmny1-nbr1.bbnplanet.net        0%    4    4     6    6    7      7     7. p1-0.nycmny1-cr11.bbnplanet.net         0%    4    4     6    6    6      6     8. pos2-1.pr1.lga1.us.mfnx.net             0%    4    4     6    6    6      6     9. so-3-0-0.cr2.lga1.us.mfnx.net           0%    4    4     7    7    7      7    10. so-1-0-0.cr2.iad1.us.mfnx.net           0%    4    4    11   11   11     11    11. so-1-0-0.cr2.dca2.us.mfnx.net           0%    4    4    11   11   11     11    12. so-5-3-0.mpr4.sjc2.us.mfnx.net          0%    4    4    73   73   76     81    13. pos8-0.mpr1.sjc2.us.mfnx.net            0%    4    4    73   73   73     74    14. pos0-0.mpr2.lax2.us.mfnx.net            0%    4    4    82   82   82     82    15. pos11-0-0.mpr1.lax1.us.mfnx.net         0%    4    4    83   83   83     83    16. 208.184.95.130.mdr-icann.zoo.icann.o    0%    4    4    83   83   83     83    17. www.example.com                         0%    4    4    83   83   83     83 

The session continues to send packets and update the display until we break out of it by typing Q or <ctrl>-C. MTR uses essentially the same kind of traceroute algorithm as above to determine the path between you and the destination host but then uses pings (ICMP echo requests) to gather statistics about the reachability of each router. Remember that many routers will treat ICMP traffic differently from other traffic. As mentioned earlier, a busy router may decide that ICMP requests destined for the router itself are a lower priority than traffic passing through the router. For this reason, the statistics presented by MTR sometimes will not represent the same conditions that normal user traffic would encounter.

The MTR man page lists a number of options; those most commonly used are listed in Figure 9.3. As noted at the top of the display, you can also use the R key to reset the statistics and the D key to toggle into two other display modes for viewing packet statistics.

Figure 9.3. Commonly Used MTR Options.

Option

Meaning

-n

Do not perform DNS lookups

-g

Force use of the graphical interface

-t

Force use of the terminal interface

-h

Print help

Aside from the fancy display and the ping statistics, there is an additional advantage to using MTR. Unlike traceroute, MTR will not block when it hits a hop for which it cannot determine the router. That is, when traceroute sends out a packet with the TTL set to five, it will wait for the ICMP error response from the router five hops away before it goes on to send a packet with TTL six. If for some reason the router that is five hops away does not respond, traceroute will never learn about the routers later in the path. MTR, however, will try to access routers a few hops ahead, even if one of the earlier routers does not respond.



Open Source Network Administration
Linux Kernel in a Nutshell (In a Nutshell (OReilly))
ISBN: 130462101
EAN: 2147483647
Year: 2002
Pages: 85

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net