Back to roadmap
Module 4 · Edge: DNS, CDN, Load BalancersDay 03325 min

Anycast and BGP

One IP, many physical locations, the network picks the closest.

Day 033

Anycast and BGP

203.0.113.1
edge
US site
service
EU site
service
APAC site
service
Signal path
One IP advertised from three sites
203.0.113.1
edge
flow
US site
service
203.0.113.1
edge
flow
EU site
service
203.0.113.1
edge
flow
APAC site
service
Memory hook

Anycast and BGP: one ip, many physical locations, the network picks the closest

Mental model

move the first decision closer to the user

Design lens

Long TCP flows can rebalance to a new site mid-flight.

Recall anchors
MechanismUseLimits

Why it matters

Anycast announces the same IP from many points; BGP routing carries clients to the nearest one. It powers DNS, public CDN edges, and global load balancers.

Deep dive

BGP picks routes based on AS-path and policy; 'nearest' is in AS-hops, not always physically closest.

Anycast is great for stateless services (DNS, TLS termination) and TCP with short flows; long-lived connections can hop sites on route changes.

Major clouds offer global anycast IPs (e.g., AWS Global Accelerator, GCP Global LB) so you can build global front doors.

Demo / scenario

Replacing GeoDNS with anycast for an API.

  1. Same IP announced from US, EU, APAC.
  2. Each user's BGP route picks nearest.
  3. Client failover is automatic if a site withdraws.
  4. No DNS TTL bottleneck.

Tradeoffs

  • Long TCP flows can rebalance to a new site mid-flight.
  • BGP convergence on outages is in tens of seconds.
  • Cost: anycast networks are not cheap.

Diagram

203.0.113.1
US site
EU site
APAC site
One IP advertised from three sites.

Mind map

Check yourself

Loading quiz…

Sources & further reading