Bookmarks

Anycast

An addressing method in which one IP address is assigned to many nodes at different points in the network, and routing delivers a packet to the nearest of them.

Also: anycast address

checked 9 Nov

All terms

A client sends a packet to the same IP address every time, and the network itself decides which of the many nodes holding that address receives it, usually the nearest. The idea was described in RFC 1546, “Host Anycasting Service”, in 1993; today DNS servers, CDN nodes and the global load balancers of cloud providers run on anycast.

How it works

  • Each node assigned the address announces it to its neighbours over BGP as an ordinary route to a network.
  • The client doesn’t know how many copies of the service exist: it sends the packet to an ordinary address.
  • Routers pick the shortest path by their own metric, so traffic generally arrives at the nearest node.
  • The network handles failure by itself: when a node at one location disappears along with its announcement, traffic moves to a neighbouring one.

State and TCP

RFC 1546 defines anycast as a stateless service: the network is not obliged to deliver two consecutive packets to the same node. For a DNS query this doesn’t matter, but a long-lived TCP connection is sensitive to path changes: if packets start arriving at a different location in the middle of a session, the connection may break. That is why an anycast address usually fronts the entry to a service, such as a DNS query or the first request to an edge node, while load balancers inside the location distribute traffic among specific servers.

Where it is used

  • DNS servers and CDN nodes: one address serves the whole network of locations, and the request goes to the nearest one.
  • Global cloud load balancers: the global external Application Load Balancer in Google Cloud has one anycast address for all regions.
  • DDoS protection: attack traffic is scattered across many locations, and each absorbs its share locally.
  • IPv6: every subnet has a reserved subnet-router anycast address, and packets sent to it are delivered to any router in the subnet.

Limitations

An anycast address is syntactically indistinguishable from an ordinary unicast address, so nodes have to be configured explicitly, as RFC 4291 notes. A global anycast set with no topological aggregation needs a separate entry in routing tables across the whole internet, which RFC 4291 calls a serious scalability limitation. Diagnostics are also different: different clients reach different locations through the same address, so you have to check each of them.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • load balancer

    A load balancer distributes requests among servers within a site; anycast brings the client to the nearest site at the routing level.

  • CDNcontent delivery network

    A CDN is a network of nodes for delivering content; anycast is an addressing method that such networks often use to bring a client to the nearest node.

  • BGPBorder Gateway Protocol

    BGP is a route-exchange protocol; anycast is built on it, with all nodes announcing the same prefix.

In depth in the references

where the topic is covered in detail