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).
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
- RFC 2992 Analysis of an Equal-Cost Multi-Path Algorithm
- RFC 1058 Routing Information Protocol
- RFC 2328 OSPF Version 2
- RFC 1195 Use of OSI IS-IS for routing in TCP/IP and dual environments
- RFC 5305 IS-IS Extensions for Traffic Engineering
- RFC 5880 Bidirectional Forwarding Detection (BFD)
- RFC 5286 Basic Specification for IP Fast Reroute: Loop-Free Alternates
All 60 documents this chapter cites, each with a link to its publisher and a copy kept here.
