Routing, chapter 19 of 36
Anycast and CDNs
Two laptops on two continents send a SYN to 192.0.2.80, and different machines answer from that same address.
The SYN leaves the peering LAN with a TTL of 60 and enters AS64505 at 203.0.113.20. At the same moment a laptop on another continent sends a SYN to 192.0.2.80, enters AS64505 at a different router in a different building, and gets a SYN-ACK from a different machine with the same source address. Neither laptop can tell. The address that our browser took from the DNS names a service, and the routing system chose the building long before the SYN was sent.
- 2046
- operational root server instances by the count of root-servers.org, run by 12 operators, on 13 November 2026
- 0.15 %
- about that share of vantage point and service combinations showed regular TCP flipping toward the root letters
- /24
- the covering IPv4 prefix an anycast service often needs to survive import filters
Catchments of 192.0.2.0/24
A model: three sites of AS64505 announce one prefix. Withdraw a site or lengthen its AS path, and watch the catchments move and what happens to our open TCP connection.
What does it mean for one address to be in many places?
RFC 4786 (December 2006, BCP 126) by Joe Abley and Kurt Erik Lindqvist supplies the vocabulary. Anycast makes a Service Address available at two or more Anycast Nodes, and the routing system delivers each datagram to one of them (RFC 4786, Section 2). The region whose packets reach one node is its catchment, a term from physical geography for the area that one river drains.
Nothing in the packet marks the difference (RFC 7094, Section 1). The route for 192.0.2.80 is a /24 and not a host route, because a host route cannot be propagated "with confidence" in BGP, as a matter of operational policy (RFC 4786, Section 4.4.2).
Who thought of this first?
Craig Partridge, Trevor Mendez, and Walter Milliken of BBN did, in RFC 1546 (November 1993), an IRTF memo that proposes no protocol. Their example was archie: a user would type telnet archie.net and reach the nearest server. They wanted a separate class of addresses, perhaps as few as 2^16, so that a host could tell when it talked to an anycast address. That class was never assigned.
In April 2002 Ted Hardie of Nominum described the practice for authoritative name servers in RFC 3258. It needed no dedicated address space and no routing changes (RFC 3258, Section 1).
How did the root servers become the proving ground?
The root zone has 13 server names, and anycast lets each name grow. By late 2007 at least 10 of the 13 used it (RFC 7094, Section 1). In January 2014 RFC 7108 documented L-Root as 273 nodes in 143 locations.
More instances do not automatically mean lower latency. In a 2017 study with more than 7,900 RIPE Atlas probes, C with 8 instances had about the same median round-trip time as K with 33 and L with 144, all between 30 and 32 ms (RFC 9199, Section 3.2.1).
Can a TCP connection survive on an anycast address?
Usually, as long as the routing system's choice of node stays stable for much longer than one transaction (RFC 4786, Section 4.1). If border1's port on the exchange fails during the page load, AS64500 falls back to the transit route, and AS64510 may deliver the next segment to another site. That site's listener answers a segment with the ACK bit set with a reset (RFC 9293, Section 3.10.7.2). The browser opens a new connection, which lands at the new site and works.
QUIC's preferred_address offers what RFC 1546 asked of TCP (RFC 9000, Section 9.6).
Why anycast a whole web service when the BCP says it does not scale?
The scaling problem of RFC 4786, Section 4.4.8 is one covering route per service. The same document gives the way out: many service addresses under one covering prefix (RFC 4786, Section 4.8). In 2020 Cloudflare described data centers in more than 200 cities that all serve the same addresses [Wragg2020].
In 2021 only 35 percent of users of Microsoft's anycast CDN saw any latency inflation, against more than 95 percent for root DNS. In the authors' explanation, Microsoft places an anycast site at every location where it peers, and the direct peering route usually wins [Koch2021]. AS64505's site at the exchange is that arrangement in miniature.
What happens inside the site?
Three routers of AS64505 bring the SYN's TTL to 57. The top-of-rack router holds several equal-cost /32 routes for 192.0.2.80, one from each machine that announces the address while its service is healthy. Its ECMP hash picks the machine with MAC address 00:00:5e:00:53:80.
Plain ECMP moves a quarter to a half of all flows when a machine joins or leaves, nearly all with modulo-N hashing (RFC 2991, Section 4). A moved TCP flow is reset. Maglev hashing [Eisenbud2016] accepts a few extra moves for an even table. In a constructed table with 8 backends and 65537 slots, removing one changes 12.68 percent of slots, against 87.49 percent for modulo-N.
The book keeps asking
This chapter has 5,520 words and 12 questions. These 6 are answered only in the book and the audiobook.
- What does anycast do under attack?
- How does DNS choose a server instead?
- What does EDNS Client Subnet reveal?
- What does the edge do with the request?
- Why put the cache inside the ISP?
- Can one CDN hand a request to another?
Open the sources
- RFC 1546 Host Anycasting Service
- RFC 4786 Operation of Anycast Services
- RFC 7094 Architectural Considerations of IP Anycast
- RFC 3258 Distributing Authoritative Name Servers via Shared Unicast Addresses
- RFC 7871 Client Subnet in DNS Queries
- RFC 6707 Content Distribution Network Interconnection (CDNI) Problem Statement
- [Eisenbud2016] Maglev: A Fast and Reliable Software Network Load Balancer. Proceedings of the 13th USENIX Symposium on Networked Systems Design and Implementation (NSDI '16), pp. 523-535
All 50 documents this chapter cites, each with a link to its publisher and a copy kept here.
