Network & delivery

5 min readUpdated

What is Anycast?

Quick answer

Anycast is a routing technique where the same IP address is advertised from many locations at once, and the internet's own routing decides which one each visitor reaches — normally the closest in network terms. One address therefore resolves to different physical servers depending on where you are. For content delivery it means lower latency without per-region hostnames, and for DDoS protection it means an attack is automatically divided across every location instead of concentrating on one.

01How it works

Under normal unicast routing, an IP address belongs to one place and every packet for it travels there. Anycast breaks that assumption deliberately: multiple locations announce the same prefix over BGP, and each network in between picks whichever announcement looks best from its position. RFC 7094 describes it as making a service address available 'in multiple, discrete, autonomous locations'.

'Nearest' means nearest in routing terms, not in kilometres. BGP chooses routes by policy and path, so a visitor's packets can land at a site further away than the closest one if that is where their provider's routing points. The set of visitors that reach a given site is called its catchment, and catchments are rarely tidy.

No special client support is needed. The visitor's computer opens a connection to an address, and the network delivers it to whichever instance its routing prefers. From the visitor's point of view, nothing about it is unusual.

02Unicast, anycast, multicast and broadcast

Anycast is one of four ways an address can map to receivers. IPv6 defines anycast addresses explicitly and drops broadcast altogether: RFC 4291 states that 'there are no broadcast addresses in IPv6', their job being done by multicast.

ModeOne address reachesTypical use
UnicastExactly one hostAlmost all internet traffic
AnycastThe nearest of many hosts sharing the addressDNS, CDNs, DDoS mitigation
MulticastEvery host that joined the groupIPTV and market data, mostly inside one network
BroadcastEvery host on the local segmentARP and DHCP in IPv4

03What it gives you

  • Lower latency, because a nearby location answers without any DNS trickery
  • Automatic failover: if a location goes offline its announcement disappears and traffic reroutes
  • Attack division: a distributed attack is split across locations by the same routing that splits real traffic
  • One address to manage rather than a different hostname per region
  • Proven at the largest scale: root-servers.org listed more than 2,000 instances behind the 13 root server names in October 2026, run by 12 independent organisations

04Why it matters for DDoS protection

A botnet attacking an anycast address does not get to choose where its traffic lands. Each bot is routed to whichever location its network prefers, so an attack from machines spread across the world is spread across the network in roughly the same proportion. The same holds for amplification attacks, whose reflected traffic enters the network near the reflectors rather than near the victim.

This turns a single-point problem into a shared one. RFC 4786, the operational best practice for anycast, notes that a node 'can act as a sink for attack traffic originated within its sphere of influence'. An attack that would saturate one datacentre may be entirely comfortable when divided across many, and it happens without a detection step or a failover to trigger.

The division is only as even as the catchments, though. A botnet concentrated in one region lands mostly on the sites that serve that region, and RFC 7094 warns that withdrawing an overloaded site's route simply moves the attack to another instance, potentially causing a cascaded failure.

05How to see anycast in action

Anycast DNS servers will tell you which instance answered. A CHAOS-class TXT query for hostname.bind or id.server (RFC 4892), or the NSID option (RFC 5001), returns an instance name. Run the same command from two networks and the names differ, although the address is identical; for K-root, run by the RIPE NCC, the name contains a site code.

Path tools show the same thing from the routing side. A traceroute to the same address from two vantage points ends in different places, often with short round-trip times from both. The guide to reading a traceroute and MTR explains each hop, and an IP and ASN lookup confirms that the announcing network is the same wherever you stand.

Identifying the anycast instance that answers
# Which K-root instance answers you? (CHAOS-class TXT, RFC 4892)
dig +short @k.root-servers.net hostname.bind CH TXT

# The same question through the EDNS NSID option (RFC 5001)
dig +nsid +norec @k.root-servers.net . SOA

# Where does the path end from here? Repeat from another network and compare
traceroute -n -q 1 -w 2 193.0.14.129

06The trade-offs

Anycast is a poor fit for long-lived stateful connections. Routing can change mid-session: a BGP update moves you to a different location that has no record of your connection, and as RFC 7094 puts it, the session will be reset. This is why anycast is common for DNS, HTTP and TLS, which are short and reconnect cleanly, and rare for long-running sessions unless state is shared between sites.

It also needs your own address space and BGP sessions at every site. IPv4 prefixes longer than a /24 and IPv6 prefixes longer than a /48 are 'generally neither announced nor accepted' (RFC 7454), so even a small anycast service needs at least a /24, the smallest IPv4 block the internet routes, which is why anycast is something you buy from a provider rather than build for a single service.

Because the same prefix is legitimately announced from many places, origin validation matters. Publishing RPKI route origin authorisations for the prefix lets networks that validate routes reject announcements from any other origin, which narrows the room for hijacks and leaks.

07When anycast is the right tool

Where anycast does not fit, protection usually comes from routing traffic through a filtering network that delivers only the clean part to a unicast address, the approach described in the guide to remote DDoS protection.

WorkloadFitWhy
Authoritative and recursive DNSExcellentSingle-packet queries over UDP; a retry costs almost nothing, and a DNS flood is split across every site
Websites and APIs over HTTPSGoodShort connections that reconnect cleanly; the usual design for CDNs
Long-lived TCP sessions such as SSH, VPNs or databasesPoorA route change mid-session resets the connection
Game serversUsually poorPlayers are tied to one server's state, so filtering in front of a unicast address fits better
A single server or siteNot applicableAnycast needs several sites announcing the same prefix

Questions

Frequently asked questions

A load balancer distributes requests once they arrive at your infrastructure. Anycast distributes them before that, using the internet's own routing, so traffic never converges on one location at all.

Yes, for short connections. Route changes rarely land mid-connection, and if one does, the connection resets and the client reconnects. That trade-off is fine for web requests and poor for sessions that last for hours.

Not meaningfully. Anycast needs the same prefix announced from multiple locations, which means multiple sites, your own address space and BGP. It is a network property, not a server setting.

Test it from several networks. Different instance names from DNS identification queries, traceroutes that end in different cities, and short round-trip times from distant vantage points all point to anycast. A test from a single location cannot tell.

Yes. IPv6 defines anycast addresses explicitly, as addresses assigned to more than one interface, with packets delivered to the nearest one by routing distance. In practice IPv4 and IPv6 anycast are run the same way, by announcing one prefix from many sites.

Sources

Sources and verification

dig queries run with BIND 9.18 and the traceroute command with traceroute 2.1.2 against k.root-servers.net, Debian 12, October 2026.

  1. 01RFC 7094: Architectural Considerations of IP Anycast · IAB / RFC Editor
  2. 02RFC 4786 (BCP 126): Operation of Anycast Services · IETF
  3. 03RFC 4291: IP Version 6 Addressing Architecture · IETF
  4. 04RFC 4892: Requirements for a Mechanism Identifying a Name Server Instance · IETF
  5. 05RFC 5001: DNS Name Server Identifier (NSID) Option · IETF
  6. 06RFC 7454 (BCP 194): BGP Operations and Security · IETF
  7. 07Root Server Technical Operations · root-servers.org

Last updated