How Facebook Removed Itself from the Internet: BGP, DNS, and One Backbone Command
On October 4, 2021, at about 15:40 UTC, Facebook, Instagram, WhatsApp and Messenger disappeared from the internet. Not slow, not erroring: gone. For roughly six hours, resolvers around the world could not even find out where facebook.com lived. Around three and a half billion people lost the services, and so did the company's own engineers, its internal tools and, according to reports at the time, some of its door badges.
The next day Facebook's engineering team published a short explanation. Read carefully, it describes three design decisions that were each reasonable on their own and that combined into a total outage: a backbone that could be taken down by one command, DNS servers that withdrew themselves from the internet when they lost sight of the backbone, and recovery tooling that ran over the same network that had just disappeared.
Two networks, and the thin line between them
Facebook runs two kinds of facilities. Large data centers hold the compute and storage. Smaller edge sites, spread around the world, terminate user connections and forward requests over Facebook's private backbone to the data centers. The backbone is tens of thousands of miles of fiber connecting all of them.
The edge sites also host Facebook's authoritative DNS servers. Those servers are reachable through anycast: many sites announce the same IP prefixes to the internet with BGP, and each user's traffic goes to the nearest one. Anycast is great for latency and for resilience to the loss of a single site. If one site fails, it stops announcing, and the internet routes around it within seconds.
The command
During routine maintenance, an engineer issued a command intended to assess the available capacity of the global backbone. Instead, it took down every connection in the backbone, disconnecting all the data centers from each other and from the edge.
Facebook's systems were designed to audit commands like this and block ones that could cause this kind of damage. A bug in that audit tool let this one through. The safeguard existed, and it failed silently, which is the most dangerous way for a safeguard to fail, because everyone downstream still believes it is there.
The DNS servers did exactly what they were told
Each edge DNS server ran a health check: if it could not reach the data centers, it assumed it was in a broken location and withdrew its BGP announcements, so that users would be sent to a healthier site.
For a single site, that rule is correct. It is how anycast is supposed to work. But this time every DNS server, at every site, lost the backbone at the same moment. Every one of them reached the same conclusion and withdrew. There was no healthier site to send users to. The prefixes for Facebook's name servers simply vanished from the global routing table.
From any router on the internet, it looked like this:
route-views>show ip bgp 185.89.218.0/23
% Network not in table
route-views>show ip bgp 129.134.30.0/23
% Network not in table
The DNS servers themselves were still running. They were simply unreachable. Resolvers asking for facebook.com got no answer, applications retried, and the retries piled onto public resolvers. Cloudflare reported a large spike in DNS queries on 1.1.1.1 for Facebook's domains as phones and browsers kept asking.
BGP in one paragraph
BGP is how independent networks tell each other which IP prefixes they can reach. An announcement says "send traffic for this prefix to me". A withdrawal says "stop". There is no central authority: each network believes its neighbors and passes the information on. So when Facebook's routers withdrew the DNS prefixes, the withdrawal spread across the internet in minutes, faithfully and correctly. BGP did nothing wrong. It carried out the decision Facebook's own health checks had made.
The health check was correlated with the failure
The deeper lesson is about how health checks behave in a large distributed system. A local health check answers "is this node healthy?". The decision it drives, withdrawing from the internet, is only safe if the failure it detects is local. When the check depends on a shared component, the backbone in this case, a failure of that component makes every node fail the check together, and a mechanism designed to remove one bad node removes all of them.
This is the same family of problem as split-brain in a database cluster, viewed from the opposite side. Split-brain is two halves each believing they are the only survivor and both taking over. Here, every half believed it was the broken one and all of them stepped down. In both cases, nodes are making a global decision from purely local evidence.
The usual fixes:
- Fail static. When a node loses its upstream, keep serving the last known good state rather than removing itself. Stale DNS answers would have been far better than none.
- Withdrawal budgets. Never let more than a small fraction of sites withdraw within a short window without a human confirming it.
- Independent evidence. Decide whether you are the broken one using a signal that does not share fate with the thing that broke, for example probes over the public internet rather than over the backbone.
def should_keep_announcing(backbone_ok: bool,
sites_withdrawn_last_5m: int,
total_sites: int,
external_probe_ok: bool) -> bool:
"""Decide whether this edge site keeps its anycast DNS routes."""
if backbone_ok:
return True
# If many sites are withdrawing at once, the problem is shared, not local.
if sites_withdrawn_last_5m / total_sites > 0.2:
return True # fail static: serve stale answers, page a human
# Only withdraw when an independent path confirms this site is the broken one.
return external_probe_ok
The counter in the middle has to come from somewhere that survives the failure, which is itself a design problem. But even a crude version, such as a hard rule that the last few sites never withdraw automatically, would have kept the DNS reachable.
Locked out of the building
With the backbone down and DNS gone, the tools engineers would normally use to investigate and fix the network were unreachable too. Remote access depended on the network that was down. Facebook later wrote that its out-of-band network, the separate path meant for exactly this situation, was also affected.
Engineers were sent to the data centers in person. Those buildings are designed to be hard to get into and hard to modify once you are inside, and the systems that grant access were themselves affected by the outage. It took time to get the right people physically in front of the right routers.
Turning it back on carefully
Bringing the backbone back was not a single switch either. Data centers that suddenly go from almost no load to full load can trip power and cause new failures, and caches that have gone cold send a flood of requests to the systems behind them. Facebook said it had practised this kind of recovery in "storm" drills, and restored services in stages. External monitors watched agents around the world come back one by one.
What I would take from it
| Design decision | Why it was reasonable | Why it hurt |
|---|---|---|
| Backbone changes through automated commands | Too large to manage by hand | One bad command reached every link |
| Audit tool to block dangerous commands | Protection against exactly this | A bug let the command through, silently |
| DNS sites withdraw when they lose the backbone | Correct for a single bad site | Every site withdrew at once |
| Recovery tools on the production network | Simple, always available | Unreachable when the network was gone |
| Strict physical and system security | Protects the data centers | Slowed down the people coming to fix them |
The checklist I came away with:
- Test the safeguards, not just the system. An audit tool that is never seen blocking anything is an audit tool nobody knows is broken.
- Every automatic "remove myself" mechanism needs a limit on how many nodes can use it at once.
- Out-of-band access has to be truly independent: separate network, separate DNS, separate authentication.
- Break-glass physical access should be rehearsed, with a plan that works when the badge system cannot reach its servers.
What made October 4 so striking is that no single component malfunctioned in an exotic way. A command did what it said, BGP propagated what it was given, and each DNS server followed its rule exactly. The outage lived in the gaps between those correct pieces.