trace network paths Linux
Kernel Observability
William Patterson  

Trace Network Paths in Linux

When a service slows or stops, guessing wastes time. We show a clear, repeatable way to get hop-level information so you can find the bottleneck fast.

Our approach pairs two simple tools that reveal each hop, timing, and address. That gives actionable route data you can share with upstream providers or internal teams.

We’ll cover installation, a baseline run, and how to read each hop — including when a tool needs elevated rights and when it does not. This practical intro gets you from question to clear evidence in minutes.

Table of Contents

Key Takeaways

  • You’ll get hop-by-hop timing and address details, not just reachability.
  • Using both traceroute and a non-root tool gives broader coverage.
  • Clear results speed root-cause analysis and support tickets.
  • We focus on commands you can run now on production systems.
  • Outputs provide the exact source data to share with providers or teams.

Why trace network paths in Linux matters right now

A sudden slowdown often hides a clear, measurable cause if you know where to look. We start with common, urgent scenarios so you can act fast.

Common scenarios: sudden slowness, timeouts, or unreachable services

Apps that slow without warning, intermittent timeouts, or a service that stops responding all happen in production.

Often ping still replies, but users see delays. That mismatch tells us the problem may sit between your system and the destination.

Ping vs traceroute/tracepath: reachability versus path visibility

Ping proves reachability. It does not show where packets slow or get dropped.

That’s why we use traceroute and tracepath. Both map the route and print hop-by-hop output with round-trip timings.

Tracepath usually runs without root, while traceroute offers advanced options when you need them.

  • Use these tools to decide if the issue is local, at your provider, or beyond control.
  • Capture repeatable output for teams or ISPs — show the problematic hop IP/name and rising RTTs as evidence.

Quick setup and prerequisites on popular Linux systems

Get the right tools installed now so you can act fast when a server shows problems.

Install traceroute on Debian/Ubuntu and RHEL/CentOS-family

On Debian/Ubuntu run: sudo apt install traceroute.

On RPM-based systems run: sudo yum install traceroute.

These commands add the utility you’ll use for advanced probes and protocol choices.

Confirm tracepath availability and basic permissions

Tracepath usually comes preinstalled and uses the sockets API, so it does not need sudo. That makes it handy when you can’t grant elevated rights.

Traceroute defaults to udp, but you can change the protocol with options for icmp or TCP. Some invocations will prompt for sudo because traceroute manipulates packets at a low level.

Verify your user can run these commands and that DNS name resolution works if you want names in output. On hardened servers, coordinate with security teams to allow outbound probes during incidents.

  • Install both tools on admin workstations and jump hosts.
  • Keep man pages and local docs updated for common options and defaults.
  • Store tools on bastion hosts so traces run close to the affected router or server.

This lightweight setup is usually enough to start mapping routes to any target and to collect repeatable evidence for troubleshooting.

How traceroute works under the hood

Let’s unpack the mechanics that let traceroute build a hop-by-hop map. I’ll keep this practical—no deep theory, just what you need to read output and explain it.

TTL mechanics and ICMP replies

Each probe is a packet sent with a small ttl. The first router decrements that ttl. When ttl hits zero, that router drops the packet and sends back an ICMP “time exceeded” message.

Traceroute repeats probes with higher ttl values to discover the next router, hop by hop, until the destination replies. At the end the target usually answers with an error about the UDP port being unreachable—confirming the full path.

Protocols and when sudo matters

On many systems traceroute uses UDP by default, with ICMP available via -I and TCP via -T. Choosing raw packets or alternate protocols can require root because the tool crafts packet headers directly.

BehaviorWhy it mattersPractical note
TTL decrementReveals each routerShows immediate upstream (first router) timing
ICMP time exceededIdentifies hop addressSome devices suppress ICMP, causing gaps
UDP default probesTriggers final unreachable at destinationUses unused port to elicit response
  • Reverse DNS affects whether you see names or only addresses.
  • Suppressed ICMP can mask hops—interpret asterisks accordingly.

trace network paths Linux with traceroute

Run one simple command and you’ll see each device between your host and the destination. That first probe gives a clear, repeatable view you can share with colleagues or an ISP.

A dimly lit modern office workspace, with a sleek desk and a high-resolution monitor displaying a terminal window. The terminal shows the output of a traceroute command, tracing the network path to a remote server. In the foreground, a close-up view of a laptop, its screen displaying a network diagram with node connections and latency information. The background features a network rack with blinking indicator lights, casting a soft glow throughout the scene. The overall atmosphere conveys the technical nature of network troubleshooting, with a focus on the traceroute tool and its role in understanding network paths.

Essential syntax and a first test

Use the basic command: traceroute <hostname_or_IP>. Try it against a known service to get your first full path map in seconds.

Key options for control and speed

  • -n — skip DNS lookups to speed output and focus on raw addresses.
  • -w <seconds> — set per-probe timeout when links are slow.
  • -m <max_ttl> — cap the maximum number hops so traces finish quickly.
  • -4 / -6 — force IPv4 or IPv6 to check dual-stack differences.

Reading traceroute output

Each line starts with the hop number. Next comes the router’s name or address and three round-trip time values by default.

Watch the time values across hops — growing RTTs often pinpoint where latency appears. Remember: traceroute sends three packets per hop by default, so variability shows intermittent problems.

Examples and practical tips

For a snappy, useful trace use: traceroute -n -w 2 -m 15 <destination>. This limits maximum number hops and lowers wait time per probe, giving fast, actionable output for on-call checks.

Tracepath basics for quick, non-root troubleshooting

For quick triage from a locked-down workstation, a simple path probe often answers the core question. We reach for this tool when we need a fast check without sudo.

Run a basic test like tracepath server01 to learn how many hops you traverse and whether timing stays steady. Add -p 8080 to test a specific service port, -m 42 to limit probes, or -n to skip DNS lookups for speed.

What the output shows and why it helps

Output prints hop number, an address or name, and a single round‑trip time per hop. It also reports MTU values discovered along the path—handy for spotting fragmentation issues early.

OptionEffectWhen to use
-m <number>Limits number hops probedKeep traces short during fast checks
-p <port>Probes specific destination portValidate a service rather than general reachability
-nSkips DNS lookupsSpeeds output and shows raw addresses
-6Forces IPv6 probesTest v6-only connectivity
  • We use this tool for safe, non-root testing from help desks and admins with limited rights.
  • Gaps or missing messages often mean the device ignored the probe—not necessarily a hard failure.
  • Combine a quick path scan with a service check to decide if you need deeper diagnostics.

Diagnose real issues: from high latency to filtering

I start by scanning RTTs across adjacent hops to spot where latency first jumps. A steady rise that begins at one hop and continues downstream usually points to a bottleneck at or beyond that router.

Watch for lines with only asterisks. Those often mean timeouts caused by ICMP or UDP filtering, rate limits, or devices that silently drop probe messages. Don’t assume dropped probes equal dropped traffic—confirm downstream reachability first.

Load balancing can show multiple routers at the same hop number. That happens when equal-cost routes split your packets. Asymmetric routing can also make a hop look slow if the return path takes a different route.

Repeat traces a few times and note the first router to separate local issues from upstream provider problems. If you see inconsistent results, try changing protocol or port to determine whether filtering is protocol-specific.

OutputLikely causeAction
Rising RTT from hop NBottleneck at or beyond routerCorrelate with traffic, repeat trace
Asterisks (*)ICMP/UDP filtered or rate limitedTry different protocol/port
Different addresses on same hopLoad balancingRun multiple probes, annotate output
  • Annotate output with concise notes—this helps routing teams act fast.

Advanced traceroute techniques for deeper analysis

A few extra options can turn a noisy, confusing output into clear, actionable information. I walk through targeted techniques that help you isolate filtering, fragmentation, and load balancing quickly.

Protocol and port testing

Verify whether a firewall blocks a service by testing TCP to the app port: traceroute -T -p <port> <dest>. If UDP replies are missing, switch to ICMP with -I to compare behavior.

Stability with more queries and focused ttl ranges

Use -q to increase probes per hop and reduce single-sample noise from load balancing. Limit the ttl range when you want to concentrate on a suspect segment and speed repeated checks.

MTU, fragmentation, and pairing with ping

Shrink probe sizes to spot fragmentation clues, then confirm with targeted ping tests that check PMTU. If TCP succeeds but UDP fails, treat that as strong evidence of ACLs or protocol-specific filtering.

  • Run repeated traces and note any consistent outlier hop number — that’s your escalation point.
  • Keep a short command set in your notes: -n -q 5 -w 2 for quick, reliable samples.
  • Document results and the exact commands so on-call engineers can reproduce findings.

Cross-platform note: comparing Linux tools with Windows tracert

When Windows is the only endpoint, its built-in tracert command gives a fast, shareable route snapshot.

Tracert mirrors the TTL-incrementing method and shows hop address, name, and timing. It uses icmp only, so you cannot change the protocol or probe a specific port like you can with traceroute.

That simplicity makes tracert handy on a help desk machine or a Windows server with no extra tools installed. Run it to capture the hop sequence and save the output for escalation.

  • Quick example: a tech runs tracert example.com to collect hop addresses and names for triage.
  • If tracert returns asterisks because ICMP is filtered, try traceroute from a Linux or alternative system with TCP/UDP probes.
  • Collect both Windows and traceroute outputs to compare whether the route differs by source or destination.
ToolProtocolWhen to use
tracertICMPQuick checks on Windows systems or desktops
tracerouteICMP/UDP/TCPDeep probes, port or protocol testing
BothSave outputs to correlate router sequence and find consistent problem points

Putting it all together for reliable, repeatable troubleshooting

A consistent command set and simple documentation turn ad-hoc probes into reliable evidence.

We recommend a short playbook: schedule baseline traceroute linux runs during normal ops, record the number hops and the default options you use, and save traceroute output with exact address and name snippets.

During incidents, run the same command set, compare round-trip time patterns along the path, and repeat probes to reveal load balancing or variance. Use ttl ranges to focus on a suspect node, and try alternate packets and ports to confirm filtering.

Capture annotated outputs in tickets, correlate from another source, and treat the playbook as living documentation—update commands, timeouts, and depth as your network evolves.

FAQ

What does "Trace Network Paths in Linux" help me find?

It shows the sequence of routers and hosts that packets traverse from your system to a destination. That helps you spot where latency spikes, packet loss, or filtering occur so you can target fixes — for example, adjusting routing, contacting a service provider, or filing a support ticket with precise hop information.

When should I run a path discovery tool versus a simple reachability check?

Use ping (reachability) when you only need to confirm a host responds. Use traceroute or tracepath when you need visibility into the intermediate hops — for example, during sudden slowness, timeouts, asymmetric routing, or when services become unreachable despite successful pings.

How do I install traceroute on Debian/Ubuntu and RHEL/CentOS families?

On Debian or Ubuntu run “sudo apt update && sudo apt install traceroute”. On RHEL, CentOS or AlmaLinux use “sudo yum install traceroute” or “sudo dnf install traceroute” depending on your package manager. Confirm installation by running the tool without arguments to see usage text.

Is tracepath available and does it need root privileges?

tracepath is usually preinstalled on many distributions and runs without root. It uses user-level sockets to probe and reports hop MTU. Some traceroute options require sudo — notably when sending raw packets or using TCP probes — but basic traceroute and tracepath tests often run fine as a regular user.

How does traceroute discover each hop?

It sends packets with incrementing TTL values. Each router that decrements TTL to zero replies with an ICMP “time exceeded” message, revealing its address. The process repeats until the destination replies or the maximum hop count is reached.

What protocols can traceroute use and why choose one over another?

By default many traceroute implementations send UDP. Use -I to force ICMP echo requests, or -T to use TCP SYN (with -p to pick a port). TCP often bypasses filters that drop non-TCP probes, improving accuracy when firewalls block UDP or ICMP.

What do the numbers in traceroute output mean?

Each line starts with a hop number, followed by an address or hostname, then one or more round-trip time (RTT) samples in milliseconds. Multiple RTTs per hop show variance — rising RTTs across successive hops usually point to a bottleneck.

Why do I sometimes see asterisks (*) or missing hop names?

Asterisks mean a probe timed out or a router didn’t send an ICMP “time exceeded” reply. Routers may drop probes, rate-limit ICMP, or block certain protocols. DNS resolution failures show addresses instead of names — use -n to force numeric output.

How can I limit the maximum number of hops or adjust timeouts?

Use -m to set the maximum TTL (max hops) and -w to change the probe timeout. For example, “-m 20 -w 2” limits to 20 hops and waits 2 seconds per probe. Adjusting these helps when paths are long or when some hops are slow to respond.

When should I use tracepath instead of traceroute?

Use tracepath for quick checks without root and when you want simple MTU discovery along the route. It’s lighter-weight and often “good enough” for day-to-day troubleshooting. For protocol-specific or more detailed probing, use traceroute.

How do I detect MTU or fragmentation issues with these tools?

tracepath reports discovered MTU values along hops. With traceroute, you can infer fragmentation problems by pairing tests with ping using the DF (don’t fragment) flag and increasing packet size until you hit a limit — this helps locate the hop that enforces a smaller MTU.

What indicates a bottleneck or congestion in hop results?

Look for a sudden increase in RTT starting at a specific hop — consistent high latency on subsequent hops suggests the congestion point. Intermittent spikes or packet loss concentrated at one hop also point to a local problem rather than the destination.

Can load balancing or asymmetric routing change traceroute output?

Yes. Per-flow load balancing or multiple parallel links can cause different probes to take different routes, producing varying hop sequences or alternating addresses. Run multiple tests and increase queries per hop (with -q) to detect such behavior.

How do I test using TCP or a specific port to avoid filtering effects?

Use traceroute -T -p PORT to send TCP SYN probes to a chosen port (e.g., 80 or 443). This often traverses firewalls that allow established TCP sessions, giving a more accurate path to services that block UDP or ICMP.

How does Windows tracert differ from Linux tools?

Windows tracert typically uses ICMP Echo by default and shows less option flexibility. Linux traceroute supports UDP, ICMP, and TCP probes, advanced options for query counts, timeouts, and numeric output. Cross-platform differences can cause different results — use comparable probe types when comparing.

Any tips for repeatable, reliable troubleshooting?

Run tests multiple times, vary protocols (ICMP, UDP, TCP), force numeric output to avoid DNS delays (-n), and log timestamps. Combine traceroute/tracepath with ping, mtr, and packet captures when needed. That gives a consistent dataset for diagnosis and reporting to providers.