今日已更新 240 条资讯 | 累计 22430 条内容
关于我们

How traceroute Really Works: TTL, ICMP Time-Exceeded, and Mapping a Path Hop by Hop

pathvector-dev 2026年07月17日 08:00 3 次阅读 来源:Dev.to

Originally published at https://blog.pathvector.dev/protocol-lab-trace-19/ — part of the free Protocol Lab series. This post is part of Protocol Lab , a free, hands-on series for learning networking protocols by building and breaking them in a container lab. All the lab material — topologies, configs, and scripts — lives in the repo: github.com/pathvector-studio/protocol-lab . Every IP packet carries a TTL (time to live) that each router decrements by one. When it reaches zero, the router drops the packet and sends back an ICMP time-exceeded message. traceroute turns this rule into a map: send probes with TTL 1, 2, 3, … and each dying probe reveals the router at that distance. Reading guide: rfc-notes/traceroute-ttl.md Prerequisite: TCP Lab 07: Handshake and Teardown (reading captures) Expected time: 40–55 minutes. The Goal This lab builds a real multi-hop path and shows the mechanism: client → r1 → r2 → server , with two Linux routers in the middle, traceroute from the client lists each hop: 10.0.1.2 (r1), 10.0.2.2 (r2), 10.0.3.2 (server), a packet capture shows the ICMP time-exceeded replies (from r1 for TTL 1, from r2 for TTL 2) that traceroute is built on. By the end, you should be able to explain this table: Probe TTL Dies at Reply 1 r1 ( 10.0.1.2 ) ICMP time-exceeded from r1 2 r2 ( 10.0.2.2 ) ICMP time-exceeded from r2 3 server ( 10.0.3.2 ) reaches the destination What You Will Learn What the IP TTL field is for (loop protection) and how routers decrement it. What an ICMP time-exceeded message is and who sends it. How traceroute uses increasing TTLs to discover each hop. Why the hops appear in order, and why the last hop is the destination itself. The difference between forwarding (routers) and being an endpoint. This lab does not cover: UDP vs ICMP vs TCP traceroute probe types in depth (we use ICMP mode). Load-balanced paths (ECMP) where hops can vary between probes. Why some hops show * * * (rate limiting or filtered ICMP) in the real internet. Where to Rea

本文内容来源于互联网,版权归原作者所有
查看原文