Cart

    Sorry, we could not find any results for your search querry.

    How to measure packet loss in Linux?

    It can on a rare occasion happen that your VPS has a network connection, but your connection to your server is slow or choppy, for example as a result of packet loss. This can be caused by firewall settings on your server, or by a cause in an external network.

    To be able to say more about a potential cause, we ask our customers with this kind of problem to send us the results of a traceroute, or MTR (the abbreviation for the My TraceRoute software).

    A traceroute combines the latency/packet-loss information of a 'ping' with the route information of a 'traceroute' and is therefore very useful for diagnostic purposes.


    Installing MTR in Linux

    MTR is a standalone program / application that is commonly present in most modern Linux distros (depending on your installation). You may however have to install it on your OS before you can use it.
     

    • Linux:

      CentOS / AlmaLinux / Rocky Linux:
      sudo dnf -y install mtr

      Ubuntu / Debian:
      sudo apt -y install mtr

     

    • Mac OS X:

      You can download a self-installer on this website. You can also install MTR via homebrew or macports via the command or "ports install mtr" for use in the OS X terminal.

    Using MTR to measure packet loss in Linux

     

    Perform an MTR traceroute using the command below. In this command, change IPADDRESS to the IP address or hostname you'd like to change.

    mtr IPADDRESS

    This provides a real-time MTR which continues until you stop it and only by pausing the MTR (press P) can you optionally select the output and then copy-paste.

    A good alternative is to indicate in advance how often you want to run the MTR and to make the output immediately suitable for copy-paste actions. You can do this with the following command:

    mtr --report-cycles=20 IPADDRESS

    The --report-cycles determine how often you'd like MTR to run. The final result then displays the average measurements of the 20 mtr commands. You're welcome to change the amount of cycles from 20 to another number.

    As an example, below is the output of an MTR to Google.com (mtr --report-cycles=20 google.com):

    Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                                              Packets               Pings
     Host                                                   Loss%   Snt   Last   Avg  Best  Wrst StDev
     1. gw.ams4.transip.net                                  0.0%    20    0.6   7.7   0.6  62.6  13.4
     2. l5.f2.ams4.transip.net                               0.0%    20    1.6  17.9   1.6 224.6  48.9
     3. s2.r1.ams0.transip.net                               0.0%    20    0.4   1.0   0.4   5.8   1.3
     4. r1-a0.e1.ams0.transip.net                            0.0%    20    0.8   0.6   0.5   0.8   0.1
     5. core1.ams.net.google.com                             0.0%    20    1.3   2.3   0.9  12.2   2.8
     6. 2001:4860:0:f8a::1                                   0.0%    20    1.2   1.3   1.1   2.3   0.3
     7. 2001:4860:0:1::611b                                  0.0%    20    1.1   1.1   1.0   1.3   0.1
     8. ams15s48-in-x0e.1e100.net                            0.0%    20    1.3   1.2   1.0   1.4   0.1

    Need help?

    Receive personal support from our supporters

    Contact us