Skip to content
shellmap

tracepathTrace the path to a host without root — unprivileged traceroute across all 5 shells

Equivalents in every shell

Bashunix
tracepath google.com

From `iputils`. Unlike `traceroute`, `tracepath` does NOT require root — it uses UDP probes via the unprivileged path-MTU-discovery infrastructure. Output adds `pmtu` (Path MTU) lines when the MTU changes between hops, useful for diagnosing tunnel / VPN MTU issues. Add `-n` for numeric output (no DNS lookups, ~3× faster).

Zshunix
tracepath google.com

Same `iputils` binary on Linux. On macOS, `tracepath` is NOT installed by default — use `traceroute` (BSD-derived, ships with macOS) or install via `brew install iputils`. macOS `traceroute google.com` works without sudo on most modern macOS versions; older releases required sudo for ICMP / UDP probes.

Fishunix
tracepath google.com

Same external. For "do all hops respond at all" sanity check: `tracepath -n example.com` is the lightest hammer. If `tracepath` shows `no reply` for ~30 consecutive hops, the destination is unreachable (or every router along the way drops ICMP — common on cloud VPC paths).

PowerShellwindows
Test-NetConnection -ComputerName google.com -TraceRoute

Native cmdlet (`Test-NetConnection`, alias `tnc`). `-TraceRoute` enables hop-by-hop output; `-Hops 30` (default 30) caps the trace depth. The output is `TraceRoute` property as a `string[]` of IP addresses. For a richer hop-by-hop trace including per-hop latency, fall back to the system `tracert.exe` invoked from pwsh.

cmd.exewindows
tracert google.com

`tracert` is the Windows builtin — uses ICMP echo-request packets (not UDP like Unix `traceroute`). Flags: `-d` no DNS lookups, `-h <count>` max hops (default 30), `-w <ms>` per-hop timeout. `pathping google.com` is the richer variant — combines tracert + ping, gathers per-hop loss statistics over 25 seconds. Slower but more informative.

Worked examples

Trace path to a host

Bash
tracepath -n google.com
Zsh
traceroute google.com
PowerShell
Test-NetConnection google.com -TraceRoute
cmd.exe
tracert google.com

Diagnose packet loss per hop

Bash
mtr -n google.com
PowerShell
Test-NetConnection google.com -TraceRoute -InformationLevel Detailed
cmd.exe
pathping google.com

Skip DNS lookups for faster tracing

Bash
tracepath -n google.com
Zsh
traceroute -n google.com
PowerShell
Test-NetConnection google.com -TraceRoute | Select-Object -ExpandProperty TraceRoute
cmd.exe
tracert -d google.com

Gotchas

  • `tracepath` uses UDP probes; `traceroute` (Unix) defaults to UDP but can be forced to ICMP with `-I`; `tracert` (Windows) uses ICMP. Some routers drop UDP probes but pass ICMP (or vice versa) — if one tool shows all-stars-no-reply and another works, the difference is probe protocol, not connectivity. `traceroute -I` on Linux matches Windows `tracert` behaviour.
  • EVERY internet path includes routers that intentionally do NOT respond to traceroute probes (rate-limiting, ICMP filtering, or simply not configured to send TIME-EXCEEDED). Stars-in-the-middle do NOT mean packet loss — they mean that specific router doesn't talk to you. The end-to-end reachability is shown by the FINAL hop succeeding, regardless of middle stars.
  • Path-MTU detection (`tracepath`'s special feature) reports the smallest MTU along the path. Common failure mode: a tunnel reduces MTU to 1400 mid-path but the source still sends 1500-byte packets — these get dropped silently if the path also blocks ICMP "fragmentation needed" messages (PMTUD blackhole). `tracepath` SHOWS that 1400 boundary; `traceroute` does not.
  • PowerShell `Test-NetConnection -TraceRoute` is much SLOWER than `tracert.exe` for unknown reasons (it appears to wait the full timeout on every hop even when the reply arrives quickly). For interactive use, `tracert -d google.com` from pwsh is faster. For scripted parsing, `Test-NetConnection` is easier because the output is an object.
  • Some VPN clients install a default route that captures ALL traffic — your `tracepath` then shows the VPN provider's router as hop 1, not your LAN gateway. Useful debugging hint: if hop 1 of `tracepath 8.8.8.8` is a 10.x.x.x address you don't recognise, check your VPN status.

WSL & PowerShell Core notes

pwsh`Test-NetConnection` is Windows-only (it lives in the `NetTCPIP` / `Net.PowerShell` module). On Linux/macOS pwsh, shell out: `& tracepath` (Linux) or `& traceroute` (macOS). For a cross-platform pwsh trace, `Test-Connection google.com -TraceRoute` since pwsh 7.4 (2024) — note the `Test-Connection` cmdlet (not `Test-NetConnection`) is the cross-platform one and added `-TraceRoute` in 7.4.
WSLInside WSL `tracepath` traces from the WSL VM's perspective — hop 1 is typically the WSL2 NAT gateway (the Windows host's virtual switch), then hops continue from there. To trace from the Windows host's perspective, run `tracert.exe google.com` (the `.exe` works directly from WSL bash). The difference matters for diagnosing "is the slow hop inside my LAN or upstream" — WSL's perspective adds one virtual hop the Windows host does not see.

Related commands