LinuxCommandLibrary

traceroute

TLDR

Trace route to a host

$ traceroute [host]
copy
Use ICMP echo instead of UDP
$ traceroute -I [host]
copy
Use TCP SYN for probes
$ sudo traceroute -T [host]
copy
Set maximum hops
$ traceroute -m [20] [host]
copy
Set number of probes per hop
$ traceroute -q [1] [host]
copy
Use a specific port
$ traceroute -p [80] [host]
copy
Force IPv4 or IPv6
$ traceroute -4 [host]
copy
Don't resolve hostnames
$ traceroute -n [host]
copy

SYNOPSIS

traceroute [options] host [packetsize_]

DESCRIPTION

traceroute displays the route packets take to reach a network host. It sends probe packets with incrementing TTL (Time To Live) values, causing each router along the path to respond with an ICMP "time exceeded" message, revealing its address.
Each line shows a hop number, router hostname/IP, and round-trip times for each probe (default: 3). Asterisks (*) indicate no response within the timeout period—this may be due to firewalls, rate limiting, or packet loss.
Different probe methods work better in different networks: ICMP (-I) may be blocked by firewalls, TCP (-T) can reach hosts that block other probes, and UDP (default) works for unprivileged users but may be filtered.

PARAMETERS

-4, -6

Force IPv4 or IPv6
-I
Use ICMP ECHO for probes
-T
Use TCP SYN for probes (requires root)
-U
Use UDP datagrams (default)
-m MAX
Maximum number of hops (default: 30)
-q NQUERIES
Number of probes per hop (default: 3)
-w WAIT
Wait time for response in seconds (default: 5.0)
-p PORT
Destination port (UDP base or TCP destination)
-n
Do not resolve IP addresses to hostnames
-N NUM
Number of simultaneous probes (default: 16)
-f FIRST
Start from specified TTL (default: 1)
-F
Set "Don't Fragment" bit
-i INTERFACE
Specify network interface
-s SOURCE
Use specified source address
-z PAUSE
Pause between probes (seconds or milliseconds if >10)
-A
Perform AS path lookups
--mtu
Discover MTU along the path
-V
Show version

CAVEATS

Many networks filter ICMP or UDP traceroute packets. Asymmetric routing means the return path may differ from the forward path shown. Response times include processing delays at each hop, not just transmission time. Some routers don't decrement TTL or respond to probes. TCP mode requires root privileges.

HISTORY

traceroute was written by Van Jacobson in 1987 at Lawrence Berkeley Laboratory. It became an essential network diagnostic tool, included in virtually all Unix-like systems. The concept exploits the TTL field's original purpose of preventing routing loops. Variants include tracepath (doesn't require root), mtr (combines ping and traceroute), and Windows tracert.

SEE ALSO

ping(8), mtr(8), tracepath(8), netstat(8)

Copied to clipboard