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.


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

    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. 

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 (                                  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.                         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.                           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
  • +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
  • 1
    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

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

while true; do
  date >> mylogfile.txt
  ping -c 5 sometestnode >> mylogfile.txt
  sleep 5

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.

  • 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 traceroutes). – voretaq7 Aug 18 '11 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.