mtr (My Traceroute)

The mtr command, also known as My Traceroute, is a network diagnostic tool that combines the functionality of traceroute and ping. It provides a dynamic, real-time view of the route packets take to reach a destination and measures the performance of each hop along the way. Here's a detailed explanation of how to use mtr, its options, and what information it provides:

Basic Usage

To use mtr, open a terminal and type:

mtr <hostname or IP address>

For example:

mtr google.com

This command starts mtr in an interactive mode, displaying the network path to the specified host and providing real-time statistics about each hop.

Output Explanation

The default mtr output consists of columns representing different metrics for each hop:

  • Host: The hostname or IP address of each hop.

  • Loss%: The percentage of packet loss at each hop.

  • Snt: The number of packets sent to each hop.

  • Last: The round-trip time (RTT) of the last packet sent.

  • Avg: The average RTT.

  • Best: The best (shortest) RTT.

  • Wrst: The worst (longest) RTT.

  • StDev: The standard deviation of the RTT.

Example output:

Additional Options

mtr provides several options to customize its behavior and output. Some of the most commonly used options are:

  • -r: Generate a report in non-interactive mode.

  • -c : Specify the number of pings to send.

  • -w: Use wide output format (show both IPv4 and IPv6 addresses).

  • -b: Show both the hostnames and IP addresses of the hops.

  • -n: Do not resolve hostnames (show only IP addresses).

  • -i : Set the interval between packets (default is 1 second).

Example command using options:

This command generates a report (-r) with 10 pings (-c 10) and uses a wide output format (-w).

Use Cases

  1. Network Troubleshooting: Identify where packet loss or high latency occurs in the network path to a destination.

  2. Performance Monitoring: Monitor the performance of network links over time.

  3. Network Planning: Assess the quality of different routes for network optimization.

Conclusion

mtr is a powerful network diagnostic tool that provides real-time information about the path packets take to a destination and the performance of each hop. By understanding its output and options, administrators and users can effectively troubleshoot network issues, monitor performance, and optimize network routes.

Last updated