A hands-on walkthrough of rebuilding traceroute from scratch in Rust, explaining the TTL trick that makes it work. Covers sending UDP packets with incrementally increasing TTL values, reading raw ICMP replies, parsing packet bytes manually, adding timing, implementing three probes per hop, and detecting when the destination is reached. Also explains why traceroute needs sudo, what asterisks mean, ICMP rate limiting, and the limitations of traceroute output including asymmetric paths and MPLS tunnels. The final implementation is about 80 lines of Rust.

11m read timeFrom tech.stonecharioteer.com
Post cover image
Table of contents
What does traceroute do? #The first probe #Some Simplifications #What is ICMP? #Knowing when to stop #Adding timing #Three probes per hop #Comparing with real traceroute #What traceroute doesn’t show #Why Do We See * ? #Why does this need sudo? #Wrapping up #References #

Sort: