How packets find their way
Each router lowers a packet's TTL by one. When it reaches 0 the packet is thrown away, so a packet caught in a loop cannot circle forever.
Try the simulator before reading anything else. Set TTL to 2 and press Send, then set it to 64 and send again. Watch where the packets stop the first time.
Drag to turn. Scroll or pinch to zoom.
What you just saw: a countdown in every packet
With TTL 2, every packet died at the second router it met and a red message came back. With 64, the packets reached the server with 60 left after four routers. The IPv4 header has an 8-bit field called Time to Live (TTL), so its largest value is 255. RFC 791 says every router must lower it by at least one, and many computers start it at 64. When it reaches 0 the router drops the packet and sends an ICMP "Time Exceeded" message (RFC 792) back to the sender. That was the red message.
Why have a countdown at all? A mistake in the routing tables could send a packet round in a circle, and without a limit it would use links forever. The name says "time", and on paper RFC 791 measures it in seconds. But every router takes off at least one, so in practice it works as a count of hops. IPv6 gave the same field a plainer name, Hop Limit.
The traceroute button uses this rule to draw a map. It sends a probe with TTL 1: the first router drops it and replies, which reveals that router's address. TTL 2 reveals the second router, and so on until the destination answers. Press it and read the list it builds. Then cut R1 to R3 and send again to see the packets take another way.
Each router looks up one line in a table
No router knows the whole route from your laptop to a server on another continent. Each one makes a single decision: for this destination address, which neighbour gets the packet next? The packet moves one hop, and the next router decides again. A route is a chain of these local choices.
The decision comes from a forwarding table, a list of prefixes, each with the neighbour to use. The router picks the entry that matches the destination with the longest prefix, because a longer prefix is a more exact match. Say the table sends 203.0.0.0/16 to neighbour B and 203.0.113.0/24 to neighbour A. A packet for 203.0.113.9 matches both, the /24 wins, and it goes to A. A packet for 203.0.7.1 matches only the /16, so it goes to B. Most tables also have a default entry for everything else; in a home router it points to the ISP.
| Packet for | Entries that match | Sent to |
|---|---|---|
| 203.0.113.9 | 203.0.113.0/24 (A), 203.0.0.0/16 (B), default (ISP) | A, longest (24 bits) |
| 203.0.7.1 | 203.0.0.0/16 (B), default (ISP) | B, longest (16 bits) |
| 8.8.8.8 | default 0.0.0.0/0 (ISP) | ISP |
Who writes the tables
Inside one company, routers share what they can reach using routing protocols and work out new paths when a link fails. Between the tens of thousands of separate networks that make up the internet, the Border Gateway Protocol (BGP, RFC 4271) carries announcements such as "I can reach 198.51.100.0/24". When a cable is cut, routes through it are withdrawn and traffic shifts to whatever path is left. In the simulator, that is what happened when you cut R1 to R3.
Most lost packets fall out of a full queue
Routers also make packets wait. At busy moments packets arrive faster than an outgoing link can carry them, so each router keeps a queue in memory. When the queue is full, the next packet to arrive is simply dropped. Nobody is told; the sender can only work it out later. This is the most common way packets go missing on the internet, more common than a cut cable. A weak Wi-Fi signal can also spoil a frame so that it has to be thrown away. IP itself promises nothing. RFC 791 says it does not provide a reliable communication facility, with no acknowledgements and no retransmissions. Getting lost data back is left to the computers at the two ends, and that is the next unit.
A 3,000,000-byte photo is 2055 packets
Links limit how big one packet may be. On Ethernet one frame carries at most 1500 bytes of payload (RFC 894). Take away 20 bytes of IPv4 header and 20 bytes of TCP header, and about 1460 bytes of your data fit in each packet. A 3,000,000-byte photo therefore needs 3,000,000 ÷ 1460 ≈ 2054.8, rounded up to 2055 packets, and each one is routed on its own.
- A packet leaves with TTL 64 and passes 4 routers. What is its TTL when it arrives?
- TTL is an 8-bit field. What is the largest value it can hold?
- What does a router do when a packet's TTL reaches 0?
- Drops it and sends ICMP Time Exceeded to the sender
- Sends it on with TTL 64
- Sends it back to the sender
- Keeps it until the network is quiet
- Why does TTL exist?
- So a packet caught in a routing loop cannot circle forever
- To measure the speed of light
- To say how long a web page may be cached
- To count the packets in a file
- traceroute sends a probe with TTL 1. Who answers?
- The first router on the path
- The destination server
- The DNS resolver
- Nobody
- A table has 203.0.113.0/24 → A and 203.0.0.0/16 → B. Where does a packet for 203.0.113.9 go?
- A
- B
- Both
- Neither
- Same table. Where does a packet for 203.0.7.1 go?
- B
- A
- Both
- It is dropped
- About 1460 bytes of data fit in one packet. How many packets does a 3,000,000-byte file need?
- Which protocol carries route announcements between the separate networks of the internet?
- BGP
- DNS
- HTTP
- UDP
- In the simulator you cut R5 to the server. What happens?
- Nothing gets through: the server has only one link
- Packets go around through R4
- Packets arrive faster
- Only UDP packets get through
- "Each router knows the whole path to the server." Each router only picks the next hop from its forwarding table. The route is whatever chain those single choices make, and packets of the same message can take different routes.
- "TTL is how many seconds a packet has left." RFC 791 does describe it in seconds, but every router must take off at least one, so in practice it counts hops. IPv6 renamed it Hop Limit. The TTL on a DNS record is a different value with the same name, and that one really is in seconds.
- "Most lost packets come from broken cables." Most are dropped by busy routers whose queues are full, and a weak Wi-Fi signal spoils frames too. A cut cable is rarer, and the routers can often send traffic around it.
- "IP makes sure every packet arrives." RFC 791 says IP does not provide a reliable communication facility: no acknowledgements, no retransmissions. Recovery is done by the two end computers, usually with TCP.
- Routers decide one hop at a time using a forwarding table; the longest matching prefix wins.
- BGP spreads route announcements between networks and withdraws routes when links fail.
- TTL (IPv6: Hop Limit) drops by 1 per router; at 0 the packet is dropped and ICMP reports it.
- traceroute maps a path by sending TTL 1, 2, 3 and so on.
Sources for this course (28)
- (checked 2026-10-17; reordered 2026-10-19: standards first, then official documentation, then operators and papers, history sources last)
- IETF RFCs (rfc-editor.org): RFC 768 UDP (1980, 8-byte header)
- RFC 791 IPv4 (1981, 32-bit addresses, "does not provide a reliable communication facility", TTL field "measured in units of seconds" but every module must decrease it by at least one, so it is only an upper bound)
- RFC 792 ICMP (Time Exceeded)
- RFC 801 NCP/TCP transition plan (1 January 1983)
- RFC 894 Ethernet (1500-byte payload)
- RFC 1034 and RFC 1035 DNS (1987, HOSTS.TXT kept by SRI-NIC, labels up to 63 octets and names up to 255, TTL in seconds)
- RFC 1122 (127.0.0.0/8 loopback)
- RFC 1918 private addresses (10/8, 172.16/12, 192.168/16)
- RFC 2131 DHCP, RFC 3022 NAT, RFC 3596 AAAA records, RFC 3849 and RFC 5737 documentation addresses, RFC 4271 BGP-4, RFC 4291 IPv6 text form, RFC 6298 TCP retransmission timer (initial RTO 1 second)
- RFC 6335 port ranges (0-1023, 1024-49151, 49152-65535)
- RFC 7766 DNS over TCP, RFC 8200 IPv6 (128-bit addresses, Hop Limit)
- RFC 8446 TLS 1.3 (one round-trip handshake)
- RFC 9000 QUIC and RFC 9114 HTTP/3, RFC 9110 HTTP semantics (status code classes)
- RFC 9293 TCP (three-way handshake, sequence numbers)
- IANA: ip-parameters registry (recommended default TTL 64)
- IPv4 free pool depleted 3 February 2011 (NRO and ARIN announcements)
- Official documentation: MDN Web Docs "How does the Internet work?" (45 cables for 10 computers, switches, routers, MAC and IP addresses, internet and web)
- "What is a URL?", "HTTP response status codes" (developer.mozilla.org)
- Cloudflare Learning Center: "What is DNS?" (four kinds of DNS server, 8 steps of an uncached lookup, browser and OS caches, TTL)
- "What is HTTP/3?" (cloudflare.com/learning)
- Google Chrome Help, "Browse in Incognito mode" (support.google.com/chrome/answer/95464, checked 2026-10-19: Incognito limits what is saved to the device; websites and organisations that manage your network, like your school, employer or internet service provider, may be able to observe your activity)
- Operators and papers: root-servers.org (13 root name servers run by 12 organisations, 2047 instances on 2026-10-17)
- Jacobson and Karels 1988, Congestion Avoidance and Control (loss mostly congestion)
- History blocks only: UCLA Samueli School of Engineering, Internet50 (first ARPANET message "LO", UCLA to SRI, 29 October 1969, 22:30)
- historyofinformation.com and Wikipedia ARPANET (Kline)
- Spiceworks/SRI history (HOSTS.TXT kept by SRI-NIC)
- Numbers (2^32, 2^96, 45 and 6 cables, packet counts, round-trip times)
Checked: 2026-10-17