Anycast
In short: A transmission type in which the same destination address is offered by several servers at different locations — the request is automatically routed to the one that is closest in network terms.
In more detail: Frequently used for globally distributed DNS root servers or CDN infrastructure: users in Europe and the USA reach the same IP address, but depending on routing automatically end up at the nearest data centre — which reduces latency and spreads load.
In Depth
How the routing actually works
Technically, anycast works by having the same IP address announced simultaneously via BGP (Border Gateway Protocol, the routing protocol of the global internet) by several physically separate servers at different locations. Every internet router decides independently over which of its known paths it forwards a packet to this address — usually based on the BGP “AS path length” (number of autonomous systems traversed), not the actual geographical distance. This occasionally leads to unintuitive results: a user in a city without a direct, well-connected provider link can theoretically end up at a location that is further away but “closer” in network terms (fewer hops away). From the client’s point of view, it still looks like a completely normal connection to a single IP address — the existence of several servers remains completely hidden.
Well-known examples
The best-known public anycast services are DNS resolvers: Cloudflare’s 1.1.1.1 and Google’s 8.8.8.8 are announced simultaneously from dozens to hundreds of physical locations worldwide, so that every request automatically lands at the nearest data centre. The 13 DNS root server “addresses” (A to M) are also each actually anycast addresses behind which hundreds of physical servers are hidden — without anycast, every DNS root query in the world would have to reach one of only 13 actual machines, which practically wouldn’t scale.
Advantages over DNS-based load balancing
The big advantage over classic DNS-based load balancing (also called GeoDNS, where the DNS server returns different IP addresses depending on the requester’s location): anycast reacts to failures almost instantly. If a server location fails, it simply stops announcing its route via BGP, and internet traffic is automatically diverted to the next available location within seconds — without clients having to update their DNS cache (which often stays valid for minutes, see TTL). GeoDNS, on the other hand, is bound to the TTL of the returned A record and can only compensate for failures with a corresponding delay.
Limits and areas of use
The drawback: anycast can only be used sensibly for stateless or well-replicated services (DNS resolvers, CDN edge servers, DDoS protection infrastructure), since theoretically a request can land at a different location with every BGP routing update — for services with long-lived session state (e.g. an ongoing file upload connection) this is problematic, because a change of target server in the middle of the transfer would break the connection. That’s why in practice anycast is often only used for the initial connection (e.g. the initial TLS handshake), while the actual application logic behind it relies on classic load balancing with session persistence.
Anycast is also used specifically for DDoS defence: if attack traffic is automatically spread across dozens of global locations instead of hitting a single server, the load per location is considerably reduced (“traffic scrubbing” providers use exactly this principle).
See also: Unicast, Multicast, Load balancing, DNS