Making Sense of The Infinite

Unlocking Infinite Possibilities Through Curiosity

MTR – My Trace Route : A Powerful Network Diagnostic Tool

MTR (My Traceroute) is a comprehensive network diagnostic tool that amalgamates the functionalities of the traditional ping and traceroute commands. By providing real-time analysis of the network path between a source and a destination, MTR assists in identifying issues such as latency, packet loss, and routing anomalies.

Installation:

  • macOS:
  1. Install Homebrew: If Homebrew is not already installed, open the Terminal and execute:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. This command installs Homebrew, a popular package manager for macOS.
brew install mtr
  1. Run MTR with Elevated Privileges: MTR requires root privileges to function correctly. Use sudo to run MTR:
sudo mtr example.com
  • Ubuntu:
  • Update Package List: Open the Terminal and update your package list:
sudo apt update
sudo apt install mtr
sudo mtr example.com

Basic Usage:

To initiate MTR in its default interactive mode, execute:

mtr example.com

This command displays a real-time, updating list of network hops from your machine to the target, showing metrics like packet loss and latency for each hop.

Advanced Commands:

  • Report Mode (-r or –report): Generates a single report instead of the continuous interactive display. This is particularly useful for logging or sharing the results.
mtr --report example.com

Specify Number of Pings (-c or –report-cycles): Defines the number of pings sent to each hop. When used with --report, it determines how many cycles to run before generating the report.

mtr --report --report-cycles 10 example.com

No DNS Resolution (-n or –no-dns): Displays IP addresses without resolving hostnames, which can speed up the process and reduce clutter.

mtr --no-dns example.com

UDP Mode (-u or –udp): Employs UDP packets for the trace, which can be useful in certain network environments.

mtr --udp example.com

Set Packet Size (-s or –psize): Adjusts the size of the probe packets. This can help in testing how different packet sizes affect the network path.

mtr --psize 1500 example.com

Limit Number of Hops (-m or –max-ttl): Sets the maximum number of hops (Time To Live) to probe, which can be useful to avoid tracing beyond a certain network segment.

mtr --max-ttl 15 example.com

Interval Between Pings (-i or –interval): Specifies the time interval between each probe. The default is one second.

mtr --interval 0.5 example.com

Output in JSON (-j or –json): Provides the output in JSON format, which is useful for integrating MTR results into other tools or scripts.

mtr --json example.com

Interpreting MTR Output:

MTR’s output includes several columns:

  • Host: The hostname or IP address of each hop.
  • Loss%: Percentage of packet loss at each hop.
  • Snt: Number of packets sent.
  • Last: Latency of the most recent packet.
  • Avg: Average latency.
  • Best: Lowest latency recorded.
  • Wrst: Highest latency recorded.
  • StDev: Standard deviation of the latency, indicating variability.

By analyzing these metrics, you can pinpoint network segments experiencing high latency or packet loss

Last revised on

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *