Skip to main content
networking

Anycast

Anycast assigns the same IP address to multiple servers in different locations. Routers direct traffic to the nearest instance based on BGP path selection. CDNs, DNS root servers, and DDoS mitigation services use anycast to serve users from the closest point of presence – reducing latency and distributing load geographically.

Definition

Anycast is a routing technique where multiple nodes advertise the same IP prefix via BGP. Routers on the internet naturally select the closest node based on AS path length, IGP metrics, and BGP local preference. Cloudflare, Google (8.8.8.8), and all 13 DNS root server letters use anycast. Benefits: lower latency (users hit the nearest PoP), automatic failover (withdrawing a BGP announcement shifts traffic to the next-closest node), and DDoS absorption (attack traffic splits across all anycast nodes rather than concentrating on one). Anycast works well for stateless protocols (DNS, CDN) and connection-oriented protocols with short-lived connections (HTTPS with session resumption). Long-lived TCP connections can break if routing changes shift traffic to a different anycast node mid-session – QUIC's connection IDs solve this.

Examples

  • dig @1.1.1.1 – reaches the nearest Cloudflare anycast node
  • All DNS root servers (a.root-servers.net through m.root-servers.net) are anycast
  • ping 8.8.8.8 – hits the nearest Google DNS anycast instance (RTT reveals location)

Related Protocols

Related Terms