Skip to main content

How Does Traceroute Work: A Step-by-Step Breakdown

Traceroute is a network diagnostic tool used to track the path packets take from a source device to a destination across an IP network, helping identify routing paths and any potential delays or failures.

Here’s how traceroute works:

  1. ICMP and TTL (Time-To-Live): Traceroute sends packets with an initial TTL value of 1. The first router the packet encounters decrements the TTL by 1, causing it to reach zero. When the TTL hits zero, the router discards the packet and sends back an ICMP "TTL expired" message to the source. This helps the source router document the identity (IP address) of the responding router as part of the path.
  2. Incrementing TTL: Traceroute then increases the TTL by 1 for each subsequent packet. The second router will forward the packet to the next hop until the TTL expires, at which point it also sends a TTL expired message back to the source. The process repeats, each time documenting the responding routers and the path the packet follows.
  3. Tracking Response Times: Traceroute also measures the time it takes for each router to return the TTL expired message, giving insight into the round-trip time (RTT) for each hop. This helps identify latency at each step along the way.
  4. Completion at Destination: When the packet reaches the final destination, instead of sending a "TTL expired" message, the destination device sends an ICMP "port unreachable" message back to the source. This happens because traceroute typically sends packets to a high, unused UDP port number (above 30,000) that no services are actively listening on. Since no application is using this port at the destination, the destination host returns a "port unreachable" message. This response signifies to the source that the trace is complete, as the packet has successfully reached the destination.

The "port unreachable" message confirms that the destination device has been reached, and it marks the end of the traceroute process. This behavior allows traceroute to conclude that the path has been fully traced, with all intermediate hops documented.

 


Comments

Popular posts from this blog

Basic MPLS BGP and L3VPN Lab Setup

In this lab, we’ve set up a basic MPLS, BGP, and L3VPN environment, which is a great foundation for understanding how service providers build scalable networks. The lab uses the EVE-NG simulator along with Router IOS C7200-ADVENTERPRISEK9-M, Version 15.2(4)M8 to emulate a realistic MPLS environment. Below is a summary of the key components and roles of each router in the lab. MPLS Core Routers : The MPLS core consists of the routers responsible for label switching and forwarding customer traffic through the network: PE1 (Provider Edge 1) : Connects customer networks to the MPLS core and handles both MPLS and BGP routing. It also hosts VRF (Virtual Routing and Forwarding) instances for customers. PE2 (Provider Edge 2) : Functions similarly to PE1, connecting another customer network to the MPLS core. P1 (Core Router 1) and P2 (Core Router 2) : These routers serve as MPLS core routers and handle label switching but do not store or process customer routes directly. They simply f

OSPF Adjacency Stuck in EXSTART on Cisco IOS XR – Issue and Solution

In a recent lab setup using Cisco IOS XR on EVE-NG, I faced a common but frustrating issue with OSPF adjacencies getting stuck in the EXSTART state. After spending considerable time troubleshooting interface MTUs and configurations, I discovered that the root cause was related to the virtual network interface type being used. This post outlines the issue, troubleshooting steps, and the eventual solution that got everything working. Issue: While configuring OSPF between two routers running Cisco IOS XR in my lab, OSPF adjacencies were getting stuck in the EXSTART state. I verified that interface configurations, MTU settings, and OSPF parameters were correct, but the problem persisted. I tried adjusting the MTU size, using the mtu-ignore command, and even checked for ACLs, but nothing seemed to resolve the issue. Troubleshooting Steps: MTU Settings: I started by verifying that both sides of the OSPF adjacency had matching MTUs. I used the default MTU and even tried different values wit

How to Properly Clone an EVE-NG Lab with Configurations

Cloning labs in EVE-NG is a great way to duplicate setups and expand or experiment on a new copy without affecting the original lab. However, if not done correctly, the cloned lab may only copy the topology without configurations. In this guide, I’ll show you how to properly clone a lab in EVE-NG with all configurations using the EVE-NG GUI . Follow these steps to ensure that both the topology and router configurations are retained when cloning your lab. Steps to Clone an EVE-NG Lab with Configurations Save Running Configuration on All Devices In your original lab, make sure all devices have their configurations saved to NVRAM. Go into the CLI of each router and run the command: copy running-config startup-config Export All Configurations (CFGs) On the left sidebar in the EVE-NG Web UI , click on the "More Actions" option. Then select "Export all CFGs" . This step exports the configurations of all devices in the lab. Shutdown All Devices After exporting the confi