How the Internet works

Routing, chapter 14 of 36

Inside One Network: Forwarding, OSPF, and IS-IS

IP never had a forwarding specification of its own, and the router requirements of 1995 admit it.

The SYN leaves the home router with a TTL of 63 and arrives at bng1, the broadband network gateway of AS64500. bng1 has no entry for 192.0.2.80. It has a route to 192.0.2.0/24 that BGP supplied, and two equally short ways to reach the router that announced it. It must choose one of them and rewrite two header fields before the next packet needs the same lookup hardware.

6.72 ns
between minimum-size packets on a 100 Gbit/s port, and the lookup has to keep pace or run in parallel
512K
default IPv4 entries in the fast memory of some common switches, passed by the global table on 12 August 2014
0x0100
added to the header checksum by every router, because the TTL is the high byte of its word

Longest match, bit by bit

bng1's forwarding table as a binary trie, one node per address bit. Pick a destination or change its last octet, then walk the trie: every route the walk passes matches, and the last one wins.

Which route matches 192.0.2.80?

RFC 1812, Section 5.2.4.3 describes the lookup as pruning: discard every route whose prefix does not cover the destination, then keep the longest. At bng1 the default route and 192.0.2.0/24 cover 192.0.2.80, and the /24 wins.

Its BGP next hop is border1's loopback 198.51.100.253. A BGP next hop is usually not a neighbor, so bng1 resolves it recursively. That address matches the IS-IS route 198.51.100.253/32 with two equal-cost next hops, and the FIB entry for the /24 inherits both. BGP picks the exit, and the IGP finds the way to it.

How can a lookup finish before the next packet arrives?

A binary trie has one node per bit. For our address the walk visits 25 nodes, 25 dependent memory reads for one packet.

In 1997 Degermark, Brodnik, Carlsson, and Pink cut the address into 16, 8, and 8 bits for a three-level table. It fit 40,000 routes into 150 to 160 KB, and a typical lookup needed eight memory references [Degermark1997]. Some hardware routers use TCAM, which compares all slots at once, but at up to 24 gates per stored bit it is expensive and small [Huston2014].

Which of two equal paths does the SYN take?

RFC 1812 left the split open, and the one method it names amounts to round robin per packet. On paths with different delays that reorders TCP segments until the sender retransmits for nothing (RFC 2991, Section 2).

Hash-threshold hashes fields that stay constant for a flow, divides the key space into one region per next hop, and picks the next hop whose region contains the key (RFC 2992, Section 1). With a toy CRC-16 over the address pair, our SYN's key is 0xDD33, region 1, core2. Linux 4.4 replaced its per-lookup IPv4 multipath choice with an address hash [Linux2026].

Why not let each router tell its neighbors what it knows?

That is distance vector routing, which the ARPANET used from 1969 (RFC 1058, Section 1). C. Hedrick of Rutgers University documented RIP in June 1988 as RFC 1058.

The weakness shows when a route goes away. Neighbors keep advertising their old routes through the router that lost the link, it believes them, and the metric climbs by one per round of updates. So RIP keeps infinity small: 16 means unreachable, and a RIP network can be at most 15 hops across (RFC 1058, Section 1.1). RIP version 2 kept 16 although its metric field is 32 bits wide (RFC 2453, Section 5.3).

What did the ARPANET learn from its first link-state protocol?

Each ARPANET IMP numbered its routing updates with a 6-bit sequence number, and an update counted as newer if it was ahead by at most 32 in the circular space. On 27 October 1980 three updates from IMP 50 circulated with the numbers 8, 40, and 44. By that rule 44 was newer than 40, 40 newer than 8, and 8 newer than 44. Every IMP re-flooded each one in turn, and the network was unusable for several hours (RFC 789).

BBN's fix made the comparison strict, ahead by less than 32, which breaks exactly this cycle because 40 minus 8 is 32.

Why does the Internet run two link-state protocols?

IS-IS came from Digital Equipment Corporation. By Dave Katz's account, ANSI selected it in 1987 for OSI's connectionless network layer, and OSPF work began in 1988. In his timeline there was "Lots of OSPF deployed, but very little IS-IS" in 1992 [Katz2000].

The turn came in 1994, when Cisco rewrote its IS-IS code as a side effect of implementing NLSP, Novell's IS-IS derivative for IPX. Large ISPs were advised to use IS-IS and deployed it from 1995. Katz concluded that "Stability and scalability are largely artifacts of implementation, not protocol design".

How fast does AS64500 notice a dead link?

With hellos alone, slowly: under the sample OSPF timers a silent neighbor is declared dead after 40 seconds.

BFD is a hello protocol meant to run in the forwarding engine, so it tests the path packets actually take (RFC 5880, Section 2). The detection time is the remote multiplier times the agreed interval (RFC 5880, Section 6.8.4). With 50 ms and a multiplier of 3, a dead link is noticed after 150 ms. On a single IP hop its control packets go to UDP port 3784 and must carry a TTL of 255, which only a direct neighbor can deliver (RFC 5881, Section 4, and RFC 5881, Section 5).

core1bng1border1border2core21010, SYN51010, SYN2010
From the book: AS64500: IS-IS metrics and the path of our SYN through core2

The book keeps asking

This chapter has 5,569 words and 13 questions. These 6 are answered only in the book and the audiobook.

  • What does a router do with a packet that is not addressed to it?
  • What does a link-state router tell the others?
  • How does a router turn the map into paths?
  • Why split a network into areas, and why does AS64500 not?
  • How do two routers agree that they are neighbors?
  • What happens in the milliseconds before the network converges?

Open the sources

  • RFC 1812 Requirements for IP Version 4 Routers 1995, Proposed Standard
  • RFC 2992 Analysis of an Equal-Cost Multi-Path Algorithm 2000, Informational
  • RFC 1058 Routing Information Protocol 1988, Historic
  • RFC 2328 OSPF Version 2 1998, Internet Standard, STD 54
  • RFC 1195 Use of OSI IS-IS for routing in TCP/IP and dual environments 1990, Proposed Standard
  • RFC 5305 IS-IS Extensions for Traffic Engineering 2008, Proposed Standard
  • RFC 5880 Bidirectional Forwarding Detection (BFD) 2010, Proposed Standard
  • RFC 5286 Basic Specification for IP Fast Reroute: Loop-Free Alternates 2008, Proposed Standard

All 60 documents this chapter cites, each with a link to its publisher and a copy kept here.

Routing, chapter 15 of 36

BGP: The Protocol That Holds It Together

Routing, chapter 16 of 36

Peering, Transit, and the Money

Routing, chapter 17 of 36

Securing the Routing System

Routing, chapter 18 of 36

MPLS and Segment Routing

Routing, chapter 19 of 36

Anycast and CDNs

Transport, chapter 20 of 36

UDP: Eight Bytes of Header

Transport, chapter 21 of 36

TCP: The Connection

Transport, chapter 22 of 36

Congestion Control: From Collapse to BBR

Transport, chapter 23 of 36

Beyond TCP: SCTP, DCCP, and Multipath

Names and Trust, chapter 24 of 36

DNS: The Namespace and the Wire Format

Names and Trust, chapter 25 of 36

Resolvers, DNSSEC, and Encrypted DNS

Names and Trust, chapter 26 of 36

TLS 1.3: The Handshake

Names and Trust, chapter 27 of 36

Certificates and the Web PKI

Applications, chapter 28 of 36

HTTP: Semantics and HTTP/1.1

Applications, chapter 29 of 36

HTTP/2: Multiplexing over One Connection

Applications, chapter 30 of 36

QUIC: A Transport in Userspace

Applications, chapter 31 of 36

HTTP/3: The Web on QUIC

Applications, chapter 32 of 36

Mail: SMTP and Forty Years of Patches

Applications, chapter 33 of 36

Time, Shells, and Files: NTP, SSH, Telnet, and FTP

The Whole Path, chapter 34 of 36

Measuring and Debugging the Path

The Whole Path, chapter 35 of 36

The Whole Journey, Byte by Byte

The Whole Path, chapter 36 of 36

Ossification and What Comes Next

You have reached the server. The book goes further.

Everything on this site is a short version. Follow the Packet is the long one: 36 chapters and about 280,000 words, with every protocol fact traced to the section of the standard that defines it, every byte dump built by a script you can run, and a directory of more than a thousand cited documents. It comes as a printable book and as an audiobook.

Hear how chapter 1 opens. 70 seconds, narrated by a synthetic voice.

Get the book or the audiobook Read the start of chapter 1 Browse every source

Cover of Follow the Packet: How the Internet Works, Layer by Layer, from ARPANET to QUIC, by Wolfgang Kerschbaumer

The signup uses double opt-in. Every message includes an unsubscribe link.

Published by Sysinit Press. The public addresses, AS numbers and names of the scenario come from ranges reserved for documentation, and the home network uses private addresses, so the site describes no real network. RFC texts are copied unchanged from the RFC Editor.