traceroute Linux Command
Traces and displays the route packets take to reach a network host.
What does traceroute do?
Traces and displays the route packets take to reach a network host.
Syntax
traceroute hostPractical example
traceroute google.comQuestions about traceroute
How does traceroute work?
Traceroute sends packets with incrementing TTL (time-to-live) values. Each router along the path decrements TTL and sends back a message when TTL reaches zero.
What do the asterisks (*) mean in traceroute?
Asterisks indicate that the traceroute probe for that hop was not responded to within the timeout period. This could be due to firewalls or packet filtering.
How do I use traceroute on Windows?
Windows uses `tracert` instead of `traceroute`. The syntax is similar: `tracert google.com`.
How do I use traceroute with UDP vs ICMP?
By default, traceroute uses UDP on Linux. Use `-I` to use ICMP echo requests instead, similar to the Windows tracert behavior.
How do I set the maximum number of hops?
Use `traceroute -m 30 hostname` to set the maximum TTL to 30 hops. Default is typically 30 on most systems.
How do I do a traceroute on a specific port?
Use `traceroute -T -p 80 hostname` to use TCP on port 80. This is useful when ICMP is blocked by firewalls.
What is the difference between traceroute and mtr?
traceroute shows a one-time route trace. `mtr` combines traceroute and ping, continuously updating route information and showing packet loss per hop.
How do I install traceroute?
On Debian/Ubuntu: `sudo apt install traceroute`. On RHEL/CentOS: `sudo yum install traceroute`.
Related Networking Commands
hostSimple utility for performing DNS lookups (forward and reverse).
arpDisplays and modifies the system's ARP cache (IP-to-MAC address mappings).
nslookupQueries DNS servers to resolve domain names to IP addresses and vice versa.
routeDisplays and modifies the IP routing table.
digPerforms DNS lookups and displays detailed name server query information.
hostnameShows or sets the system's hostname.