Sikau

Computer networks · Day 4 · about 40 min

Project: Hop by hop

Forward a packet across routers, decrementing TTL — and watch a routing loop die.

Across the internet

Each router looks up the destination in *its own* table and passes the packet on. A mistake can create a routing loop — two routers bouncing a packet forever. That's why IP has a TTL (time to live): each hop subtracts one, and at zero the packet is dropped. traceroute uses exactly that to map the path.

The network

const ROUTERS = {
  home: [{ prefix: "0.0.0.0/0", via: "isp" }],
  isp: [{ prefix: "93.184.0.0/16", via: "transit" }, { prefix: "0.0.0.0/0", via: "home" }],
  transit: [{ prefix: "93.184.216.0/24", via: "edge" }, { prefix: "0.0.0.0/0", via: "isp" }],
  edge: [{ prefix: "93.184.216.34/32", via: "local" }, { prefix: "0.0.0.0/0", via: "transit" }],
};

The rest of this lesson

  • Every router decides aloneexplain
  • How traceroute worksexplain
  • TTL runs outpredict
  • One hoporder
  • forwardchallenge
  • Badge quizquiz
  • Unit 1 completerecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 12 lessons of Computer networks