Anycast Routing
Same IP announced from multiple PoPs, BGP selects closest, DDoS resilience, and how 1.1.1.1 and 8.8.8.8 work.
Overview
Overview Anycast is a network addressing and routing method where the same IP address is announced from multiple geographically distributed locations (Points of Presence, or PoPs). BGP selects the "closest" PoP based on AS path length and routing policy, so a client in Tokyo reaches the Tokyo PoP while a client in Frankfurt reaches the Frankfurt PoP — both using the same destination IP.
The mechanism works through BGP route announcements. Each PoP originates a BGP route for the same prefix (e.g., 1.1.1.1/32). BGP routers on the Internet receive multiple paths to the same prefix and select the best path based on the BGP decision process — typically shortest AS path, then lowest MED.
Anycast is the foundation of the public DNS infrastructure. Cloudflare's 1.1.1.1, Google's 8.8.8.8, and all 13 DNS root server clusters use anycast. Every DNS resolver in the world reaches its nearest instance, distributing the query load globally.
DDoS resilience is a key operational benefit: a volumetric attack (e.g., 1 Tbps UDP flood) is absorbed across all PoPs simultaneously rather than overwhelming a single IP's physical infrastructure. Cloudflare Magic Transit, AWS Global Accelerator, and Akamai all use anycast as the core mechanism for DDoS absorption.
The tradeoff is that anycast is not designed for TCP sessions that span routing changes: if a client's traffic shifts to a different PoP mid-session (due to BGP convergence), the TCP connection breaks. This makes anycast ideal for stateless protocols (DNS/UDP) and short-lived TCP connections.
Key concepts
- Anycast
- BGP Route Announcement
- PoP (Point of Presence)
- GeoDNS vs Anycast
- DDoS Absorption via Anycast
Interview questions
- How does anycast work, and how does it provide DDoS resilience?
- Compare anycast with GeoDNS. When would you use each?
Sign up free to read the full topic
More Networking topics
Start free on Cariara · Coding problems · System design studio