Anycast lets you advertise the same IP from multiple physical locations; BGP routes each user to the closest one. Powers CDNs, DNS resolvers (1.1.1.1, 8.8.8.8), DDoS-resistant edges. The internals are simpler than they sound.

Advertisement

BGP advertisement

Each location advertises the same prefix into BGP. Other networks pick the route with shortest AS-path / preferred peering. Users land at the location their ISP routes them to (often, not always, the geographically closest).

Per-flow stickiness

Anycast works for stateless (DNS) and stateful (TCP) when each location has its own state. BGP convergence rarely shifts mid-flow, so TCP usually completes on the location it started. Long-lived connections may need session-pinning above L3.

Advertisement

DDoS resilience

Attacker traffic to anycast IP gets spread across all locations. Each location only has to absorb 1/N of the attack. Why DNS resolvers and CDNs use it.

Anycast = same IP, many places, BGP routes by network distance. Great for stateless services; needs care for stateful.