Anycast and DDoS: one address, many places to absorb a flood

Anycast means announcing the same IP prefix from several locations at once, so that a packet addressed to it goes to whichever location the routing system considers closest to the sender. For a defender the useful side effect is arithmetic: a flood from machines all over the world no longer lands on one site but is divided among many. The catch is that anycast moves and divides traffic; it does not decide which packets are bad.

Section DDoS protection Updated Works at routing and network layers

Quick facts

Definition
Making one service address available in multiple, discrete, autonomous locations (RFC 4786, section 2)
Mechanism
Each location advertises a route covering the address; BGP carries it (RFC 4271)
Attack effect
A node can act as a sink for attack traffic from its own part of the network; the work is spread across nodes (RFC 4786, section 6.1)
Weak spot
TCP, without modification, does not understand anycast and can fail when routes change (RFC 7094, section 3.1)
Layer
Routing and network; it filters nothing by itself
Status of the documents
RFC 4786 is a Best Current Practice (BCP 126); RFC 7094 is an informational IAB document from 2014

Anycast is a way of arranging where traffic arrives, not a way of judging it. The filtering step that follows is on DDoS scrubbing center and the overall sequence on DDoS mitigation. The attack family anycast helps with most is described on volumetric attacks.

What anycast is

Ordinarily an IP address belongs to one place. If a thousand clients send packets to it, all thousand paths end at the same machine, or at least at the same site. With anycast, the same address is configured at several sites. RFC 4786 calls each site an Anycast Node and the shared address the Service Address. Nothing changes for a client: it sends to one address, and the network delivers the packet to one of the nodes.

How BGP picks the node

The nodes are connected by routing, not by any central dispatcher. Each one advertises a route covering the Service Address to its neighbours. RFC 4271 describes BGP as the protocol by which networks exchange reachability information as IP prefixes. When several routes to the same prefix reach a router, its decision process (section 9.1 of the same RFC) selects one using local policy and path attributes. So the node a client reaches is the one that wins that selection at each router on the way, which is why the word is "closest" in routing terms. It is not geographic distance, and it can differ from what a map would suggest.

RFC 4786 separates two kinds of node. A global node advertises the routes for global transit, so clients anywhere can reach it. A local node restricts the spread of its announcement and serves a smaller catchment. The difference matters for attacks, as the next section shows.

Anycast is not limited to defence. Its older and more common uses are DNS and content delivery, where several sites sharing an address improve response time and survive the loss of a site. The attack-spreading property follows from the same design.

How it spreads an attack

Picture a flood generated by machines in many countries, aimed at one unicast address. Every packet converges on one site, and that site's links fill. Now give the target an anycast address with nodes in several regions. The same machines still send the same packets, but each packet follows the route toward its nearest node. The flood arrives in pieces, and each piece lands on a node that has its own links and equipment.

RFC 4786, section 6.1, puts it this way: a node can act as a sink for attack traffic that originates within its sphere of influence, which keeps that traffic away from other nodes, and the work of dealing with widely distributed attack traffic is distributed across all the nodes that contribute to the service. Section 3.2 of the same document names the goal of confining the effect of an attack or a flash crowd to local regions around nodes.

  1. Division by source. A botnet with members on several continents is cut into slices by the routing system, with no action from the defender (botnets explains where such traffic comes from).
  2. Containment. A node under heavy attack can saturate without taking the others with it. Users whose routes lead to other nodes keep getting answers.
  3. Local scope. A node that announces only to nearby networks sees only attack traffic from those networks, so it cannot be flooded from the other side of the world.

The division is coarse. RFC 4786 itself says that balancing load between nodes is typically difficult to achieve; what the routing system gives is a rough, uneven spread. If most of the attack sources sit near one node, that node takes most of the flood.

Limits of anycast

  • It does not filter. Anycast chooses where packets go. A request that is a flood and a request that is a customer look the same to it. Sorting attack from legitimate traffic still has to happen at each node, as RFC 4786 describes in the same section on attack handling.
  • TCP sessions and route changes. RFC 7094 warns that most stateful transport protocols, TCP among them, do not understand anycast without modification and will fail probabilistically, possibly catastrophically. If the best route to the prefix changes mid-connection, later packets reach a different node that knows nothing of the session, and the likely result is a reset (section 4.2). RFC 4786 asks for node selection to stay stable for much longer than a transaction lasts (section 4.1). Short exchanges such as DNS queries tolerate this; long downloads and persistent connections tolerate it less.
  • Capacity per node. Division helps only if each slice fits. A node whose links are smaller than its share of the attack still fills up, and the users routed to it are affected. Total capacity across all nodes is not capacity at any one of them.
  • Withdrawing is not a cure. RFC 7094 notes that during a sustained attack one should be careful not to simply withdraw the anycast route from an overwhelmed node, since the attack can shift to another instance. Pulling a node out of rotation moves the problem rather than removing it.
  • Operational overhead. Several sites must stay consistent: the same configuration, the same data, announcements that appear and disappear as health changes. RFC 4786 warns that rapid advertisement and withdrawal oscillations can cause operational problems, which is why health-driven withdrawal needs damping.
  • Not for every service. It suits stateless or short-transaction protocols best. A service with long sessions needs design work to survive a node change.

Anycast, scrubbing and blackholing

The three are often mentioned together because all of them depend on BGP, but they answer different questions.

Anycast answers where packets arrive: at many places instead of one. Scrubbing answers what happens to them there: attack traffic is dropped and the rest forwarded. A scrubbing network can use anycast to bring traffic to its centers, and an anycast network without filters at its nodes only spreads the flood, so the two work best together; see scrubbing center. Blackholing answers the case when nothing else holds: all traffic to the attacked address is discarded, which completes the attack against that address from the victim's side. It is described on blackhole routing.

Where these are run matters as well. Spreading across many sites requires many sites, which is the argument behind buying the capacity rather than building it; the trade-offs are on cloud vs on-premise protection. A single data centre cannot be anycast by itself, because the technique needs more than one place to announce from and a network that can announce a prefix.

Questions to ask a provider

A claim that a service "uses anycast" says little. The details decide whether it helps:

  • Where are the nodes, and how large is each one's connectivity, not only the total?
  • Are nodes global, local, or a mix, and what does a local node do when it is saturated?
  • What happens to established TCP connections when a route changes, and how often does that occur in practice?
  • Is traffic filtered at each node, or sent on to central scrubbing?
  • How is an unhealthy node withdrawn, and who decides during an attack?

Answers are claims until you can test them. If the provider publishes node locations or routing data, you can inspect which networks announce the prefix; the claim about capacity you cannot check from outside. The other pages of the section, starting at DDoS protection, treat the surrounding preparation.

Where a WAF helps and where it does not

This page describes anycast as a general technique. It does not claim that Bridge WAF or Bridge CDN uses anycast. A WAF works much higher up. It looks at HTTP requests that have already arrived and decides, per request, whether they match a rule. It does not choose a route, cannot divide a packet flood among sites, and cannot make a full link bigger.

What it can do is handle valid-looking requests aimed at expensive paths, which routing tricks do not recognise. Bridge WAF has three modes:

off

Nothing is inspected. Requests reach your origin as they otherwise would.

monitor

Matches are recorded and every request is still served.

block

Matching requests are refused and still recorded.

Start in monitor, read what would have been refused, and switch to block only when the matches are the traffic you meant to stop (WAF monitor mode). The activity log records what the filter flagged; it does not show the size of a flood dropped before it reached the filter. For caps on request rates per client, see rate limiting.

Questions

What is anycast?

Anycast is the practice of making one service address available in several separate locations. Each location announces a route to the same IP prefix, usually over BGP, and the network delivers each packet to the location its routing selects, normally the nearest one in routing terms.

How does anycast help against a DDoS attack?

Attack traffic follows the same routes as any other traffic, so a flood from sources in many regions is divided among the nodes nearest to each source. Each node absorbs its own share, and a node that is overwhelmed does not necessarily take the others down. The division is uneven and each node still needs enough capacity.

Does anycast block attack traffic?

No. Anycast only decides which location receives a packet. Dropping attack packets takes filtering at the nodes, for example scrubbing, or a layer 7 filter for requests that look valid.

Can anycast break TCP connections?

It can. If routing changes mid-connection, later packets may reach a different node that has no record of the session, and the connection is likely to be reset. Short exchanges handle this well; long-lived connections need extra design. The concern is described in RFC 7094.

Does Bridge WAF use anycast?

This page makes no claim that it does. Bridge WAF is the application-layer filter in front of your origin, with three modes: off, monitor and block. Anycast is described here as a general technique, not as a feature of Bridge WAF or Bridge CDN.