Skip to content

traceroute Command Cheat Sheet

traceroute prints the route packets take to network host.


Synopsis

traceroute [options] host_name [packet_len]

Basic Usage

traceroute google.com

Output: 1. Gateway IP 2. ISP Hop 3. ... 4. Destination

* * * means the router at that hop dropped the packet (or is configured not to reply).


Protocols

By default, traceroute uses UDP. Windows tracert uses ICMP.

Use ICMP (-I)

If UDP is blocked by firewalls.

sudo traceroute -I google.com

Use TCP (-T)

Uses TCP SYN packets (port 80). Most likely to pass through firewalls.

sudo traceroute -T google.com

Performance Options

No DNS Resolution (-n)

Don't resolve IP addresses to hostnames (Much faster).

traceroute -n google.com

Set Max Hops (-m)

Default is 30.

traceroute -m 50 google.com

Set Wait Time (-w)

Wait 1 second for response instead of default 5.

traceroute -w 1 google.com

Set Query Count (-q)

Send 1 packet per hop instead of default 3.

traceroute -q 1 google.com

Other Tools

  • tracepath: Similar to traceroute but doesn't require root (uses UDP ports).
  • mtr: Combines traceroute and ping into a live updated diagnostic tool (Highly recommended).
mtr google.com

Notes

  • Root: traceroute often requires root privileges for raw socket access (ICMP/TCP modes).