Traceroute command snippets

Copy-paste-ready traceroute command snippets for common network diagnostic tasks on Linux, macOS, and Windows.

Copy-paste-ready traceroute and tracert command snippets for common network diagnostic tasks.

Run a Basic Traceroute on Linux or macOS

Traceroute sends UDP probes to a destination host and displays each hop along the network path:

traceroute example.com

Run a Basic Traceroute on Windows with tracert

Windows tracert sends ICMP Echo Request probes to a destination and displays each hop along the path:

tracert example.com

Limit Maximum Hops with Traceroute on Linux

Traceroute stops probing after the specified TTL value. Set the maximum hop count to 5 with the -m flag:

traceroute -m 5 example.com

Traceroute Windows tracert maximum TTL specific

Limit Maximum Hops with tracert on Windows

Windows tracert limits the hop count with the -h flag. Set the maximum to 5 hops:

tracert -h 5 example.com

Skip DNS Resolution with Traceroute

Traceroute displays numeric IP addresses without performing reverse DNS lookups when the -n flag is used:

traceroute -n example.com

Skip DNS Resolution with tracert on Windows

Windows tracert skips hostname resolution with the -d flag, which produces faster output:

tracert -d example.com

Use ICMP Probes with Traceroute on Linux

Traceroute on Linux sends ICMP Echo Request probes instead of UDP when the -I flag is used. This requires root privileges:

sudo traceroute -I example.com

Use TCP Probes with Traceroute on Linux

Traceroute on Linux sends TCP SYN probes to port 80 with the -T flag. TCP probes can traverse firewalls that block UDP and ICMP:

sudo traceroute -T example.com

Send One Probe per Hop with Traceroute

Traceroute sends a single probe per hop instead of the default three when the -q 1 option is used. This reduces output and speeds up the trace:

traceroute -q 1 example.com

Trace an IPv6 Route on Linux or macOS

Traceroute traces IPv6 network paths with the traceroute6 command:

traceroute6 example.com

Trace an IPv6 Route on Windows

Windows tracert forces IPv6 probes with the -6 flag:

tracert -6 example.com

Set a Custom Timeout with Traceroute

Traceroute waits 2 seconds per probe instead of the default 5 seconds when the -w flag is used:

traceroute -w 2 example.com