Operations 5 min read

Master Linux Traceroute: Install, Commands, and Advanced Options Explained

Learn how to install and use the Linux traceroute utility across Debian/Ubuntu and CentOS/RHEL systems, understand its basic syntax, explore common and advanced options, and see practical examples for network path diagnostics and troubleshooting.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Traceroute: Install, Commands, and Advanced Options Explained

In Linux, traceroute is a network diagnostic tool that determines the route packets take from your computer to a target host.

If traceroute is not installed, you can install it via the package manager.

Debian/Ubuntu and derivatives

sudo apt-get update
sudo apt-get install traceroute

CentOS/RHEL and derivatives

sudo yum install traceroute

On newer CentOS/RHEL versions, you may need to use dnf instead of yum:

sudo dnf install traceroute

Basic command format:

traceroute [options]... [target host]

Basic usage example:

traceroute example.com

Common options

-n

: Do not perform DNS lookups; show IP addresses only. -w: Set timeout in seconds. -p: Specify the destination port (default 33434). -m: Set maximum hop count (default 30). -s: Set source port number. -I: Use ICMP packets. -4 or -6: Force IPv4 or IPv6. -q: Set number of probe packets (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. -g gateway: Specify a gateway to skip. -N: Use NTP mode for time queries. -F: Set “Don’t Fragment” flag to determine MTU.

Examples

Show IP addresses only:

traceroute -n example.com

Use ICMP protocol:

traceroute -I example.com

Set maximum hops to 20:

traceroute -m 20 example.com

Use TCP protocol:

traceroute -T example.com

Use all protocols:

traceroute -A example.com

Send 5 probe packets:

traceroute -q 5 example.com

Set timeout to 10 seconds:

traceroute -w 10 example.com

Precautions

Some network devices may block traceroute packets, resulting in incomplete or inaccurate paths.

When using traceroute, comply with network policies and legal regulations to avoid misuse.

On certain Linux distributions, traceroute may require root privileges. traceroute is an essential tool for network troubleshooting and performance analysis, helping locate latency or packet loss.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

tracerouteLinuxcommand-lineNetwork Diagnostics
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.