Listing all network hops to a website can be very useful, this can be used to find where the connection is dropping out. If you try and access a website that is down, then you may see the hops stop before the website. In the example below, the hops stop before the actual website, and it is therefore not accessible,
(base) jason@jason-Lenovo-H50-55:~$ mtr --report-wide -c 4 -m 10 kiwifarms.net Start: 2022-11-09T07:12:27+1100 HOST: jason-Lenovo-H50-55 Loss% Snt Last Avg Best Wrst StDev 1.|-- 192.168.1.1 0.0% 4 0.5 0.6 0.5 0.7 0.1 2.|-- lo10.lns42.sydnmtc.nsw.vocus.network 0.0% 4 11.9 12.0 11.9 12.2 0.1 3.|-- ae14-111.edg01.sydnmtc.nsw.vocus.network 0.0% 4 25.6 27.8 22.5 33.4 4.7 4.|-- be106-99.bdr02.syd11.nsw.vocus.network 0.0% 4 14.6 14.7 14.5 14.9 0.2 5.|-- be117.cor02.syd04.nsw.vocus.network 0.0% 4 161.3 161.2 161.1 161.3 0.1 6.|-- be202.bdr03.sjc01.ca.us.vocus.network 50.0% 4 164.3 164.2 164.1 164.3 0.1 7.|-- ve108.core3.sjc1.he.net 75.0% 4 165.7 165.7 165.7 165.7 0.0 8.|-- ??? 100.0 4 0.0 0.0 0.0 0.0 0.0 9.|-- port-channel13.core3.sjc2.he.net 75.0% 4 163.7 163.7 163.7 163.7 0.0 10.|-- port-channel17.core3.nyc4.he.net 75.0% 4 228.1 228.1 228.1 228.1 0.0 |
Compare it to this example, where the website is actually accessible and all of the hops are working just fine.
(base) jason@jason-Lenovo-H50-55:~$ mtr --report-wide -c 4 -m 10 yahoo.com Start: 2022-11-09T07:15:24+1100 HOST: jason-Lenovo-H50-55 Loss% Snt Last Avg Best Wrst StDev 1.|-- 192.168.1.1 0.0% 4 0.5 0.5 0.5 0.6 0.1 2.|-- lo10.lns42.sydnmtc.nsw.vocus.network 0.0% 4 12.0 12.2 12.0 12.4 0.2 3.|-- ae14-111.edg01.sydnmtc.nsw.vocus.network 0.0% 4 14.4 14.4 14.2 14.5 0.2 4.|-- be106-99.bdr02.syd11.nsw.vocus.network 0.0% 4 14.5 14.7 14.5 15.0 0.2 5.|-- be117.cor02.syd04.nsw.vocus.network 0.0% 4 171.8 171.7 171.5 171.8 0.2 6.|-- be202.bdr03.sjc01.ca.us.vocus.network 0.0% 4 168.6 168.6 168.4 168.9 0.2 7.|-- be101.bdr03.lax01.ca.us.vocus.network 0.0% 4 170.3 170.4 170.1 170.9 0.3 8.|-- yahoo.as10310.any2ix.coresite.com 0.0% 4 171.4 171.7 171.4 172.6 0.6 9.|-- et-7-1-0.pat2.sjc.yahoo.com 0.0% 4 175.0 174.7 173.9 175.0 0.5 10.|-- ae-9.pat2.dnx.yahoo.com 0.0% 4 200.7 201.0 200.6 201.7 0.5 |
The mtr command uses ICMP packets to diagnose a connection, but you may use the UDP protocol instead. The -u parameter tells mtr to use UDP datagrams instead.
(base) jason@jason-Lenovo-H50-55:~$ mtr -u --report-wide -c 4 -m 10 kiwifarms.net Start: 2022-11-09T07:43:17+1100 HOST: jason-Lenovo-H50-55 Loss% Snt Last Avg Best Wrst StDev 1.|-- 192.168.1.1 0.0% 4 0.6 0.7 0.6 0.8 0.1 2.|-- lo10.lns42.sydnmtc.nsw.vocus.network 0.0% 4 11.9 12.6 11.9 14.3 1.1 3.|-- ae14-111.edg01.sydnmtc.nsw.vocus.network 0.0% 4 18.5 16.1 14.8 18.5 1.7 4.|-- be106-99.bdr02.syd11.nsw.vocus.network 50.0% 4 14.5 15.6 14.5 16.6 1.5 5.|-- be117.cor02.syd04.nsw.vocus.network 0.0% 4 161.0 162.6 161.0 163.2 1.1 6.|-- be202.bdr03.sjc01.ca.us.vocus.network 50.0% 4 164.5 164.5 164.5 164.6 0.1 7.|-- ??? 100.0 4 0.0 0.0 0.0 0.0 0.0 8.|-- ??? 100.0 4 0.0 0.0 0.0 0.0 0.0 9.|-- port-channel13.core3.sjc2.he.net 75.0% 4 166.3 166.3 166.3 166.3 0.0 10.|-- ??? 100.0 4 0.0 0.0 0.0 0.0 0.0 |
Use the -T parameter to use TCP instead of UDP.
Using the -o parameter allows the display of only the desired columns in the output.
(base) jason@jason-Lenovo-H50-55:~$ mtr -T --report-wide -o 'SAR' -c 4 -m 10 doomworld.com Start: 2022-11-09T08:07:21+1100 HOST: jason-Lenovo-H50-55 Snt Avg Rcv 1.|-- 192.168.1.1 4 0.6 4 2.|-- lo10.lns42.sydnmtc.nsw.vocus.network 4 13.6 4 3.|-- ae14-211.edg01.alexeqn.nsw.vocus.network 4 16.1 4 4.|-- be106-99.bdr02.syd11.nsw.vocus.network 4 15.1 4 5.|-- be116.cor01.syd11.nsw.vocus.network 4 174.1 4 6.|-- be202.bdr04.sjc01.ca.us.vocus.network 4 178.2 4 7.|-- be101.bdr04.lax01.ca.us.vocus.network 4 175.5 4 8.|-- eqix-ix-da.linode.com 4 206.9 4 9.|-- if-3-6.csw2-rin1.linode.com 4 204.1 4 10.|-- www.doomworld.com 4 203.7 4 |
We got only two columns displayed. The -o option indicates the order of the columns. SA stands for Snt and Avg. Further, we can switch the letter sequence to the -o option, so the output columns and their order are different:
- L for Loss Ratio
- D for Dropped Packets
- R for Received Packets
- S for Sent Packets
- N for Newest RTT(ms)
- B for Best RTT(ms)
- A for Average RTT(ms)
- W for Worst RTT(ms)
- V for Standard Deviation
- G for Geometric Mean
- J for Current Jitter
- M for Jitter Mean/Average
- X for Worst Jitter
- I for Interarrival Jitter
For example, Jitter is a variance in packet delays. It’s an important measure in streaming video transactions but less so in text-based communications.
To display the IP addresses of the hosts instead, use the -n parameter.
(base) jason@jason-Lenovo-H50-55:~$ mtr -T --report-wide -o 'SAR' -c 4 -n -m 10 doomworld.com Start: 2022-11-09T10:26:24+1100 HOST: jason-Lenovo-H50-55 Snt Avg Rcv 1.|-- 192.168.1.1 4 0.7 4 2.|-- 203.134.4.214 4 13.7 4 3.|-- 203.134.2.10 4 17.0 4 4.|-- 114.31.200.184 4 15.2 4 5.|-- 114.31.192.64 4 174.2 4 6.|-- 114.31.199.41 4 178.1 4 7.|-- 114.31.199.39 4 935.0 4 8.|-- 206.223.118.107 4 207.1 4 9.|-- 45.79.12.3 4 204.1 4 10.|-- 50.116.26.157 4 203.5 4 |
Using the -b option will display the numeric IP addresses and the hostnames.
(base) jason@jason-Lenovo-H50-55:~$ mtr -T --report-wide -o 'SAR' -c 4 -b -m 10 doomworld.com Start: 2022-11-09T10:32:06+1100 HOST: jason-Lenovo-H50-55 Snt Avg Rcv 1.|-- 192.168.1.1 4 0.7 4 2.|-- lo10.lns42.sydnmtc.nsw.vocus.network (203.134.4.214) 4 13.7 4 3.|-- ae14-211.edg01.alexeqn.nsw.vocus.network (203.134.2.10) 4 15.0 4 4.|-- be106-99.bdr02.syd11.nsw.vocus.network (114.31.200.184) 4 15.5 4 5.|-- be116.cor01.syd11.nsw.vocus.network (114.31.192.64) 4 174.2 4 6.|-- be202.bdr04.sjc01.ca.us.vocus.network (114.31.199.41) 4 1193. 4 7.|-- be101.bdr04.lax01.ca.us.vocus.network (114.31.199.39) 4 1188. 4 8.|-- eqix-ix-da.linode.com (206.223.118.107) 4 207.1 4 9.|-- if-3-6.csw2-rin1.linode.com (45.79.12.3) 4 204.0 4 10.|-- www.doomworld.com (50.116.26.157) 4 203.5 4 |
You may also use a much shorter interval between packets, but this requires Sudo access. This sends 20 packets with an interval of 0.1 between them.
(base) jason@jason-Lenovo-H50-55:~$ sudo mtr -c 20 -w -i 0.1 8.8.8.8 Start: 2022-11-09T10:34:38+1100 HOST: jason-Lenovo-H50-55 Loss% Snt Last Avg Best Wrst StDev 1.|-- 192.168.1.1 65.0% 20 0.5 0.5 0.5 0.6 0.1 2.|-- lo10.lns42.sydnmtc.nsw.vocus.network 0.0% 20 14.0 14.0 13.6 14.4 0.2 3.|-- ae14-211.edg01.alexeqn.nsw.vocus.network 0.0% 20 16.1 17.6 16.0 23.7 2.2 4.|-- as15169.edg01.alexeqn.nsw.vocus.network 0.0% 20 16.2 16.4 15.9 17.0 0.2 5.|-- 72.14.235.125 0.0% 20 16.3 16.2 15.7 17.0 0.3 6.|-- 209.85.247.127 0.0% 20 16.9 17.2 16.6 21.5 1.0 7.|-- dns.google 0.0% 20 16.3 16.1 15.8 16.4 0.2 |