Mastering traceroute on Linux: Install, Use, and Advanced Options
This guide explains how to install the traceroute network diagnostic tool on various Linux distributions, shows the basic command syntax and common usage examples, and details both standard and advanced options for customizing trace routes, while highlighting important precautions.
In Linux, traceroute is a network diagnostic tool used to determine the route packets take from your computer to a target host such as a website or remote server.
Debian/Ubuntu and derivatives
sudo apt-get update
sudo apt-get install tracerouteCentOS/RHEL and derivatives
sudo yum install tracerouteOn newer CentOS/RHEL versions you may need to use dnf instead of yum:
sudo dnf install tracerouteBasic command format
traceroute [options]... [target host]Basic usage example
Trace the route to example.com:
traceroute example.comCommon options
-n: Do not perform DNS lookups, show IP addresses only. -w: Set the timeout in seconds. -p: Specify the destination port (default 33434). -m: Set the maximum number of hops (default 30). -s: Set the source port number. -I: Use ICMP packets. -4 or -6: Force IPv4 or IPv6. -q: Set the number of probe packets per hop (default 3). -T: Use TCP for tracing. -A: Use all protocols (UDP, TCP, ICMP).
Advanced options
-P proto: Choose protocol (tcp, udp, icmp, ip). -S srcaddr: Set source address of packets. -g gateway: Specify a gateway to skip. -N: Use NTP mode for time queries. -F: Set the "Don't Fragment" flag to control MTU.
Examples
Do not resolve DNS, show IPs only:
traceroute -n example.comUse ICMP protocol:
traceroute -I example.comSet maximum hops to 20:
traceroute -m 20 example.comUse TCP protocol:
traceroute -T example.comUse all protocols:
traceroute -A example.comSend 5 probe packets per hop:
traceroute -q 5 example.comSet timeout to 10 seconds:
traceroute -w 10 example.comPrecautions
Some network devices may block traceroute packets, resulting in incomplete or inaccurate paths.
Use traceroute in compliance with network policies and legal regulations to avoid misuse.
On certain Linux distributions, traceroute may require root privileges to run. traceroute is an essential tool for network troubleshooting and performance analysis, helping to locate where latency or packet loss occurs.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
