Skip to content

Crack SDE

Most of the content are generated by AI, with human being reviewed, edited, and revised

Menu
  • Home
  • Daily English Story
  • Tech Interviews
  • Cloud Native
  • DevOps
  • Artificial Intelligence
Menu

How traceroute works

Posted on 12/05/202312/07/2023 by user

traceroute is a network diagnostic tool used to track the path that an IP packet takes to reach a destination. It provides information about each point (or “hop”) along the route, including the time taken to reach each hop. Here’s how traceroute works, step by step:

  1. Purpose of Traceroute: The primary goal of traceroute is to record the route (the specific gateway computers at each hop) through the Internet between your computer and a specified destination computer. It also calculates and displays the time taken to travel from your computer to each hop along the route.
  2. Packet with TTL (Time-To-Live): traceroute sends out a series of packets to the destination. These packets are unique because they have a small TTL (Time-To-Live) value. The TTL value is crucial; it’s set to ensure that the packet doesn’t circulate indefinitely in the case of routing loops.
  3. Incrementing TTL Values: The first set of packets sent by traceroute has a TTL value of 1. The TTL value is incremented by 1 for each subsequent set of packets sent out. So, the first set of packets will expire (and be discarded) after the first hop, the second set after the second hop, and so on.
  4. ICMP Time Exceeded Messages: When a packet reaches a router and its TTL has been decremented to zero, the router discards the packet and sends back an ICMP (Internet Control Message Protocol) “Time Exceeded” message to the source of the packet (your computer).
  5. Recording Each Hop: traceroute uses these ICMP messages to record the address of each hop along the route to the destination. When your computer receives the ICMP message, it notes the address of the hop and the time taken for the round trip.
  6. Repeating the Process: This process is repeated, increasing the TTL value each time, until the packets actually reach the destination. When the destination is reached, it will send back an ICMP “Echo Reply” message (assuming the destination is configured to reply), indicating that the destination has been reached.
  7. Measuring Round-Trip Time: traceroute measures the round-trip time from your computer to each hop along the route. To improve accuracy, it typically sends multiple packets per hop and calculates the average time.
  8. Completion: The process ends when the packets reach the destination or when the maximum number of hops (-m option in traceroute command) is reached, which is usually set to prevent the process from running indefinitely in case of routing loops or unreachable destinations.
  9. Output: The output of traceroute displays the list of hops along the route, including the IP address (and usually the hostname, if it can be resolved) of each hop and the time taken to reach each hop.

It’s important to note that traceroute shows the path that packets took at the time of the test. Due to the dynamic nature of routing on the internet, the path can change over time or even from one test to another. Also, some routers or firewalls are configured not to send ICMP Time Exceeded messages, which results in asterisks (*) in the traceroute output, indicating lost packets or unresponsive hops.

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X

Related

Recent Posts

  • LC#622 Design Circular Queue
  • Started with OpenTelemetry in Go
  • How Prometheus scrap works, and how to find the target node and get the metrics files
  • How to collect metrics of container, pods, node and cluster in k8s?
  • LC#200 island problem

Recent Comments

  1. another user on A Journey of Resilience

Archives

  • May 2025
  • April 2025
  • February 2025
  • July 2024
  • April 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • June 2023
  • May 2023

Categories

  • Artificial Intelligence
  • Cloud Computing
  • Cloud Native
  • Daily English Story
  • Database
  • DevOps
  • Golang
  • Java
  • Leetcode
  • Startups
  • Tech Interviews
©2025 Crack SDE | Design: Newspaperly WordPress Theme
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}