4

Is there a simple (linux cli) tool that I can run continuously for a period of time to see if the there are any connection problems between two specific network endpoints over the wan?

One remote site is experiencing slowdowns/drops and I'm looking o figure out which side of the network is at fault.

EDIT

The accepted answer recommends 'mtr'; for future reference, mtr accepts the following relevant options:

--report    
    This option puts mtr into report mode. When in this mode, mtr will run for 
    the number of cycles specified by the -c option, and then print statistics 
    and exit. 
    This mode is useful for generating statistics about network quality.
    Note that each running instance of mtr generates a significant amount of 
    network traffic. Using mtr to measure the quality of your network may result 
    in decreased network performance. 

--report-cycles COUNT
    Use this option to set the number of pings sent to determine both the 
    machines on the network and the reliability of those machines. 
    Each cycle lasts one second. 
mikewaters
  • 1,175
  • 1
  • 14
  • 27

2 Answers2

8

Take a look at mtr. It's traceroute and ping consolidated into one tool and continuously monitors the path between two hosts. You get output like that below. It's available as package mtr-tiny for Ubuntu and mtr for CentOS.

                               My traceroute  [v0.75]
somehost.lan (0.0.0.0)                                  Thu Aug 18 20:52:49 2011
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                           Packets               Pings
 Host                                    Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. somehost.lan                                0.0%    56    0.3   0.3   0.2   0.5   0.0
 2. 192.168.1.254                         0.0%    55   82.8  48.1   2.9 100.6  31.5
 3. 94-192-160-1.zone6.bethere.co.uk     76.4%    55  11038 11232 11038 11450 156.1
 4. 10.1.3.245                           25.9%    55   17.6  17.6  16.8  20.6   0.7
 5. ???
 6. ???
 7. linx1-hex.webfusion.com              96.3%    55   23.6  23.8  23.6  24.1   0.3
 8. ???
 9. supanames-22.supanames.co.uk          0.0%    55   31.4  31.4  30.5  38.0   1.0
user9517
  • 115,471
  • 20
  • 215
  • 297
  • +1. mtr is a great tool to have. – Sirex Aug 18 '11 at 19:51
  • The mtr man page states: "Using mtr to measure the quality of your network may result in decreased network performance.". Has anyone actually experienced this? If so, did the --interval and --packetsize options mitigate the problem? btw, thanks @lain! – mikewaters Aug 19 '11 at 21:21
  • 2
    i think that is just stateing that it does what it does by producing network traffic. - the traffic produced is less than tiny though. IT's essentially a few icmp ping packets. – Sirex Aug 20 '11 at 16:07
1

I would do this with a small shell script like this:

#!/bin/bash
while true; do
  date >> mylogfile.txt
  ping -c 5 sometestnode >> mylogfile.txt
  sleep 5
done

Run the script like this so it keeps running after you log out:

nohup scriptname.sh &

Once you have waited a suitable amount of time, you'll just need to kill the process and look through your log file. Of course this could be tweaked any which way you want.

JakePaulus
  • 2,347
  • 16
  • 17
  • you can also do a simple continuous ping. The disadvantage is that you don't get the timestamps in the log. Note that this won't tell you "which side" - it just tells you **when** things are slow. You would also need to ping a third location from *BOTH* sites to determine which one is experiencing the problems (a solution that presupposes it's not a routing/path specific issue which requires periodic `traceroute`s). – voretaq7 Aug 18 '11 at 19:30