DEV Community

Cover image for Internet Resilience: Anycast and BGP
Biswas Prasana Swain
Biswas Prasana Swain

Posted on

Internet Resilience: Anycast and BGP

Listen, the internet isn't some mystical "cloud" floating in the sky. It’s just a bunch of computers connected by massive wires, trying to figure out the fastest way to talk to each other without losing their minds.

If you want to understand how big players stay online when things go south, you need to understand the "street logic" of the web. Here is the breakdown of how the internet actually moves, from the IP blocks to the guys running the traffic.


1. The Setup: How the Map Works

Before we talk about fancy protocols, you need to understand the layout. Every device on the web needs a "home address." That’s your IP Address.

In the old days, the internet worked like a standard mail delivery: one address, one house. This is called Unicast. If that house burns down, the mail just piles up on the curb. No one gets their package. That's a "server down" situation, and it's bad for business.


2. IP Space & Anycast: The "McDonald’s" Strategy

What is IP Space?

Think of IP Space as a block of digital real estate. Big companies don't just buy one address; they buy the whole neighborhood (a "prefix" or "block"). They own those numbers, and they can do whatever they want with them.

What is Anycast IP?

This is where it gets clever. Instead of one IP address leading to one specific computer in a basement in Delhi, Anycast allows the same IP address to exist in a hundred different places at once.

It’s like McDonald’s. If you tell your GPS to find "McDonald's," it doesn't send you to the original one in Illinois. It finds the one closest to your current block. That is Anycast. One "name" (IP), many locations.


3. BGP: The Neighborhood Gossip

BGP (Border Gateway Protocol) is the "Waze" of the internet. It’s a group of routers constantly talking to each other, bragging about which paths are the fastest.

How the Anycast Algorithm Works (Step-by-Step):

  1. The Announcement: A server in Mumbai and a server in London both shout, "Hey, I own IP address 1.2.3.4!" via BGP.
  2. The Propagation: Every router on the internet hears this gossip and writes it down in their "routing table."
  3. The Decision: When you (in Bengaluru) try to visit 1.2.3.4, your local internet provider looks at the map. They see the Mumbai shout and the London shout.
  4. The "Shortest Path": BGP calculates which "hop" is closer. Mumbai is only 2 blocks away; London is 10. The router sends your data to Mumbai.
  5. The Connection: You get your data fast because you took the shortest route.z

Border Gateway Protocol


4. The Rescue: What Happens When a Server Dies?

This is why big tech never seems to go down.

Imagine that Mumbai server catches fire. In a "Unicast" world, you’d just get a "404 Not Found" error. But with BGP and Anycast:

  • The Mumbai server stops "shouting" its location. It goes silent.
  • The neighborhood routers realize, "Wait, Mumbai isn't talking anymore."
  • They immediately look at the next best option. London is still shouting!
  • The Rescue: Within seconds, BGP reroutes your traffic. You might notice a tiny bit of lag because the data has to travel to London now, but the site stays up.

The internet literally heals itself by choosing the next closest survivor.


Rescue, what happens when server dies


5. Setting it Up (The India Edition)

If you’re an organization in India wanting to play in the big leagues, you can't just flip a switch. You need to follow the street rules:

  1. Get an ASN: You need an Autonomous System Number. This is your "ID" that lets you talk to other networks.
  2. Acquire IP Space: You go to IRINN (Indian Registry for Internet Names and Numbers) or APNIC to get your own block of IPv4 or IPv6 addresses.
  3. Find Partners: You need "Transit Providers" (like Tata Communications, Airtel, or Reliance Jio). You sign a contract with them to let you "shout" your BGP routes through their wires.
  4. Deploy Edge Nodes: You put servers in data centers across India (Mumbai, Chennai, Delhi). You configure them all to use the exact same IP address.
  5. Start Gossiping: Fire up your BGP configuration. Tell the world you’re open for business.

Conclusion

The internet is basically just a giant, automated game of "Telephone" played by expensive routers. IP Space is your real estate, Anycast is your chain of stores, and BGP is the GPS that makes sure customers don't get lost when one store closes for repairs. It’s practical, it’s redundant, and it’s the only reason the web doesn't break every time a backhoe cuts a fiber cable.


Trustworthy References

  • Cloudflare Learning: What is Anycast? (The gold standard for Anycast explanations).
  • APNIC (Asia-Pacific Network Information Centre): Understanding BGP (The people who actually hand out the IP addresses in India).
  • Cisco Networking Academy: Routing Protocols 101 (For the deep technical guts of the "gossip").

Top comments (0)