Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Traceroute in Network Layer
Next article icon

Traceroute in Network Layer

Last Updated : 30 Jan, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Traceroute is a tool widely used by network engineers and system administrators for tracing the path a packet travels from a source point to another destination point. By sequentially tracking each router along a packet’s path, traceroute reveals not only which routers a packet encounters but also how long it takes to get from one router (“hop”) to the next.

In general this tool also shows the invisible route data packets follow which helps professionals identify, troubleshoot latency, and gain deeper insights into the network’s structure. Understanding traceroute and its mechanisms at the network layer provides the foundational knowledge needed to maintain robust, efficient, and high-performing communication channels.

Introduction to Traceroute

A traceroute is a network diagnostic tool that shows the route an IP packet takes from your computer to a specific destination. It works by sending a series of packets with increasing Time-to-Live (TTL) values to the target host. Each router along the path decreases the TTL value by one. When the TTL reaches zero, the router sends an ICMP Time Exceeded message back to the source, revealing the IP address of that router.

It shows you the complete route to a destination address. It also shows the time taken (or delays) between intermediate routers. Below is an example of the Windows operating system. 

How to Run a Traceroute?

1. Windows

  1. Open Command Prompt:
    • Press the Windows key, type "cmd," and press Enter.
  2. Run the Traceroute Command:
    • Type tracert followed by the target website or IP address, then press Enter. For example:
tracert google.com
tracert

What Does the Above Output Mean? 

A first column is a serial number for intermediate routers. In the above output, three packets are sent to every hop to get a good estimate of delays for every router. The three columns show the time taken by three different packets. The last column is the IP/Name of intermediate routers. The output shows three delays for the first hop, followed by delays for the second router and so on. 

2. macOS

  1. Open Terminal:
    • Go to the Applications folder, then Utilities, and open Terminal.
  2. Run the Traceroute Command:
    • Type traceroute followed by the target website or IP address, then press Enter. For example:
traceroute google.com

3. Linux

  1. Open Terminal:
    • Open the terminal application on your Linux distribution.
  2. Run the Traceroute Command:
    • Type traceroute followed by the target website or IP address, then press Enter. For example:
traceroute google.com

How Does Traceroute Work? 

Traceroute operates by sending a series of data packets to a target address while controlling a key parameter called the “Time to Live” (TTL).

  • Initial TTL: Traceroute starts by sending a data packet to the target address with a Time to Live (TTL) value of 1.
  • First Hop Response: The packet reaches the first router (hop), which discards it when the TTL expires and sends back an error message, revealing its IP and response time.
  • Incrementing TTL: Traceroute then sends another packet with a TTL of 2, which passes the first router and reaches the second hop, again prompting an error response.
  • IP Address Identification: By increasing the TTL by 1 each time, traceroute gradually uncovers every hop along the path, collecting addresses and delay times at each step.
  • Complete Route Mapping: This process continues until the packet reaches the destination, resulting in a map of every router the data passes through, helping identify slow links or network issues along the route.

As shown in the below diagram, there are intermediate routers between source and destination. 

Working of Traceroute

What is Traceroute Used For?

Traceroute is commonly used to:

  • Diagnose Network Problems: By showing each step along the path from your device to a target server, traceroute helps identify where delays, timeouts, or failures occur, making it easier to pinpoint the source of connectivity issues.
  • Measure Network Performance: It provides the travel time (latency) between each hop, allowing you to see which links are causing slowdowns and how efficiently data moves through the network.
  • Understand Routing Paths: Traceroute shows the exact path data takes across various routers and networks, offering insight into the complexity of internet routing and helping administrators optimize their network configurations.
  • Network Troubleshooting: It helps identify network congestions, packet loss, or routing issues.
  • Security Analysis: It can reveal potential security risks, such as misconfigured routers or unauthorized network devices.
  • Network Optimization: It helps optimize network performance by identifying slow or congested links.

How To Read A Traceroute Report?

A traceroute report is a line-by-line breakdown of the path a packet takes from your computer to a specific destination. Each line represents a "hop," or a network device, such as a router, that the packet passes through.

  • Look at the Hop Numbers: Each line in a traceroute output represents a “hop,” or a step in the journey from your device to the destination. Hop 1 is typically your local router, and each subsequent hop is another router along the route.
  • Identify the Hostnames and IP Addresses: Next to the hop number, you’ll see either a hostname, an IP address, or both. Hostnames often give clues about the router’s location or the internet service provider (ISP). For example a hostname might indicate a city or a data center.
  • Check the Response Times (Latency): Each hop usually shows a series of response times (in milliseconds). Smaller numbers mean faster responses. A sudden jump in latency can pinpoint where delays occur. For example if hops 1–5 show response times around 10–20 ms, but hop 6 jumps to 300 ms, that’s where a slowdown begins.
  • Look for Timeouts (Asterisks): If traceroute can’t get a response from a hop, it often shows asterisks (*) instead of numbers. Occasional timeouts don’t always mean a problem, some routers don’t respond to traceroute requests. However repeated timeouts might indicate a routing issue or a downed router.
  • Follow the Path to the Destination: The last line of the traceroute should show the destination’s IP or hostname with a stable response time. If the route completes, you’ll know the sequence of routers the data passed through. If it doesn’t then you can see at which hop the path fails or stops responding.

Next Article
Traceroute in Network Layer

K

kartik
Improve
Article Tags :
  • Computer Networks
  • Network Layer

Similar Reads

    Network Layer Services
    The network layer is a part of the communication process in computer networks. Its main job is to move data packets between different networks. It helps route these packets from the sender to the receiver across multiple paths and networks. Network-to-network connections enable the Internet to funct
    6 min read
    Network Layer in OSI Model
    The Network Layer is the 5th Layer from the top and the 3rd layer from the Bottom of the OSI Model. It is one of the most important layers which plays a key role in data transmission. The main job of this layer is to maintain the quality of the data and pass and transmit it from its source to its de
    5 min read
    Network Layer Protocols
    Network Layer is responsible for the transmission of data or communication from one host to another host connected in a network. Rather than describing how data is transferred, it implements the technique for efficient transmission. In order to provide efficient communication protocols are used at t
    9 min read
    Transport Layer in OSI Model
    The transport layer, or layer 4 of the OSI model, controls network traffic between hosts and end systems to guarantee full data flows. It is positioned between the network and session layers in the OSI paradigm. The data packets must be taken and sent to the appropriate machine by the network layer.
    5 min read
    Introduction of Internetworking
    Internetworking is composed of 2 words, inter and networking, which implies an association between totally different nodes or segments. This connection area unit is established through intercessor devices, such as routers or gateways. The first term for associate degree internetwork was Catenet. Thi
    8 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences