Master the Linux ‘traceroute’ Command: A Comprehensive Guide

Peter Hou
2 min readJun 3, 2023

--

This article provides a comprehensive guide to the Linux traceroute command, including its history, common uses, key parameters, and a few usage examples. Understanding traceroute is key for anyone interested in networking or Linux system administration.

Introduction

This article provides an in-depth guide to understanding and using the traceroute command in Linux. It covers the history, purpose, usage, common parameters, and examples of the command.

History

The traceroute command originated in the late 1980s as a tool to assist in network troubleshooting. The main aim was to track the route taken by packets through an IP network.

When and why to use it

traceroute is a network diagnostic tool used to trace the route that your data takes to its destination. It is useful in diagnosing network problems related to packet routing.

How to use it

To use the traceroute command, input traceroute followed by the destination (domain or IP address).

$ traceroute 8.8.8.8
Tracing the route to 8.8.8.8

The commonly used parameters

traceroute has numerous parameters that alter its behavior:

  • I This parameter sends ICMP ECHO requests instead of UDP datagrams.
$ traceroute -I www.google.com
Tracing the route to www.google.com
  • n This option tells traceroute not to try to map the discovered IP addresses to host names.
$ traceroute -n 8.8.8.8
Tracing the route to 8.8.8.8

Other supported parameters

traceroute supports several parameters, including -f, -m, -p, -q, -s, -t, -w, and -z. Each parameter provides specific functionalities to the traceroute command.

Most common use cases

The traceroute command is typically used to find out where a packet stops reaching its intended destination.

$ traceroute www.google.com
Tracing the route to www.google.com

The tricky skills

An interesting usage of the traceroute command includes using the -f option to set the initial TTL (Time to Live), which can be used to bypass the first few hops.

$ traceroute -f 3 www.google.com
Tracing the route to www.google.com starting from the third hop

What needs to be noted

One important note about using traceroute is that some routers and hosts may not respond to ICMP requests or might limit their rate, affecting the accuracy of the traceroute output.

Conclusion

Understanding how to use the traceroute command is an essential skill for any Linux user. It's a powerful tool for diagnosing network issues and verifying connectivity.

--

--

Peter Hou
Peter Hou

Written by Peter Hou

I am a Senior Software Engineer and tech lead in a top tech company.

No responses yet