traceroute

traceroute

The traceroute command is a network diagnostic tool used to track the path that a packet takes from the source machine to the destination host. It also provides the round-trip time (RTT) for each hop along the route. This is particularly useful for identifying points of failure or latency within a network.

How traceroute Works

traceroute works by sending packets with incrementing Time-To-Live (TTL) values. Each router along the path to the destination host decrements the TTL value by 1 before forwarding the packet. When the TTL value reaches zero, the router returns an ICMP "Time Exceeded" message back to the source. By starting with a TTL of 1 and incrementing by 1 for each subsequent set of packets, traceroute can determine the routers along the path to the destination host.

Basic Syntax

The basic syntax of the traceroute command is:

traceroute [options] destination
  • destination: The IP address or hostname of the target host.

Common Options

  1. Basic Traceroute Command:

    traceroute google.com

    This command traces the path to google.com.

  2. Specify Number of Queries per Hop:

    traceroute -q 3 google.com

    This sends 3 probe packets per hop (default is 3).

  3. Specify the Maximum Number of Hops:

    traceroute -m 20 google.com

    This sets the maximum number of hops to 20 (default is 30).

  4. Specify the Initial TTL Value:

    traceroute -f 5 google.com

    This sets the initial TTL value to 5.

  5. Specify the Packet Size:

    traceroute -s 64 google.com

    This sets the size of probe packets to 64 bytes.

  6. Use ICMP ECHO Instead of UDP:

    traceroute -I google.com

    This uses ICMP ECHO instead of the default UDP packets.

  7. Use TCP SYN Instead of UDP:

    traceroute -T google.com

    This uses TCP SYN packets instead of UDP packets.

Example Usage

  1. Basic Traceroute:

    This traces the route to Google's public DNS server.

  2. Traceroute with ICMP ECHO:

    This uses ICMP ECHO requests instead of UDP packets.

  3. Traceroute with a Specific Number of Queries per Hop:

    This sends 5 queries per hop.

  4. Traceroute with TCP SYN Packets:

    This uses TCP SYN packets for tracing the route.

Analyzing Output

The typical output of a traceroute command looks like this:

  • Hop Number: The first column indicates the hop number.

  • Hostname and IP Address: The second column shows the hostname and IP address of the router at each hop.

  • Round-Trip Times: The subsequent columns show the round-trip time for each of the three queries sent to each hop.

Conclusion

The traceroute command is a powerful tool for diagnosing network issues, particularly for identifying where delays or failures occur along the route to a destination. It is particularly useful for network administrators and engineers in pinpointing problematic routers or network segments. For more detailed information, consult the traceroute man page:

help

breakdown

Last updated