Anycast Routing
Anycast is a network addressing and routing method in which a single IP address is assigned to multiple servers in different geographic locations, and the internet's routing infrastructure (BGP) automatically directs traffic to the topologically nearest instance.
Anycast is a network addressing and routing method in which a single IP address is assigned to multiple servers in different geographic locations, and the internet's routing infrastructure (BGP) automatically directs traffic to the topologically nearest instance.
Anycast is distinct from unicast (one sender, one receiver), multicast (one sender, many receivers), and broadcast (one sender, all on segment). In anycast, many servers share one IP, but each individual packet is delivered to exactly one of them.
BGP Advertisement: Each anycast site advertises the same IP prefix (e.g., 203.0.113.0/24) via BGP to its upstream providers. The internet's BGP routing tables end up with multiple paths to the same prefix. Routers along the path select the route with the lowest cost (AS path length, local preference, etc.) — which typically corresponds to geographic proximity.
Client Routing: When a client sends a packet to the anycast IP, their ISP's routers forward it along the BGP-selected path toward the nearest advertising site. The client has no knowledge of anycast — it simply uses the IP address.
Use Cases: Anycast is foundational for CDN edge networks (Cloudflare, Fastly), public DNS resolvers (1.1.1.1, 8.8.8.8), DDoS mitigation (traffic is absorbed across all PoPs simultaneously), and root DNS servers.
Failure Handling: If a PoP fails and withdraws its BGP advertisement, traffic naturally reroutes to the next-nearest PoP within BGP convergence time (seconds to minutes). This provides geographic redundancy without explicit failover configuration.
Limitation: Anycast routes individual packets, not connections. TCP connections can break if a client's path changes mid-connection (e.g., due to BGP route changes). This is why QUIC/UDP is better suited than TCP for anycast deployments at scale.