Leverage BGP and Bare Metal To Build An Anycast Network

Let the internet work for you with an Anycast network on interconnected bare metal as a service

Damian Sieczkowski
Leverage BGP and Bare Metal To Build An Anycast Network

By leveraging the building blocks of the internet you can efficiently direct users to the infrastructure that is deployed closest to them. But first, you will need to build an Anycast network using Equinix Metal and a protocol that’s been around since 1994. It’s called the Border Gateway Protocol (BGP) and using it, you can build your own global Anycast network on Equinix Metal in less than 5 minutes!

Managing the internet

When it comes to geographic proximity, the internet isn’t very sophisticated. In fact, the routers that control where traffic goes on the internet just know route paths. From the perspective of a network router, a route path is determined in the simplest of terms, essentially: “how many ASNs (Autonomous Systems) are between me and the destination of the packet I’m trying to route?”

What the internet does know about location it gets from geolocation databases, which are notorious for serving up stale data. So when a router prepares to send along traffic, it doesn’t know how to determine physical proximity but it does know which route path has the fewest number of hops. As such, data occasionally takes a “scenic” route that slows down applications by adding latency and/or results in dropped packets.

At Equinix Metal — our interconnected bare metal as a service — we monitor traffic patterns and make sure to fix inefficient routes so that you (and your users) experience the lowest latency. That being said, helping users interact with the infrastructure that is closest to them is often the biggest driver of better performance.  To do this at scale for any user around the world, you only need to know two words: BGP and Anycast!

Global, interconnected bare metal

Equinix is the world’s digital infrastructure company—helping to power, protect and connect the world since 1998. With Equinix Metal™, it’s now easier than ever to take advantage of the unmatched global reach and connectivity ecosystem made possible by Equinix.

Read More
Blog_4.21.2020

The advantages of Anycast

An Anycast network allows for data addressed to a particular IP on that network to have multiple possible destinations. Unlike a Unicast network, which can only offer one possible destination. Both Unicast and Anycast are considered one-to-one routing schemes, whereas routing schemes like Multicast and Broadcast are considered one-to-many.

For a deeper look at Anycast, and how it can be implemented, checkout this Cloudflare article from Mathew Prince that details how Cloudflare deploys Anycast to build a robust fault-tolerant global network, “Load Balancing without Load Balancers.”

By using an A record that maps a domain name to a single IP address, you can keep your deployment simple and put the internet to work for you. The resulting reduced latency, and built-in high availability, means end users get a better experience and are happier. Ultimately, this is all about helping data traverse the internet as efficiently and quickly as possible.

Leveraging BGP to build an Anycast network

If Anycast is your bread, then BGP is the jelly and peanut butter. As our friends at Cloudflare describe it:

“Border Gateway Protocol (BGP) is the routing protocol for the Internet. Much like the post office processing mail, BGP picks the most efficient routes for delivering Internet traffic.”[i]

BGP is how routers share their IP address space with networks like the internet, and with Equinix Metal you can join in on the fun! You can share from a single data center, or you can do it from many. If you advertise the same address space from many data centers, voilà, you’ve got yourself an Anycast network.

There are currently two ways to build an Anycast network using the BGP on Equinix Metal:

  1. Use your own ASN and IP Blocks. This is great if you’re already setup with your own IP space. If not, you will have to buy some IP address space and setup your own ASN. The American Registry for Internet Numbers (ARIN) has a good article on how to do that.[ii] With your ASN, Equinix Metal will learn what IPs are registered to it and, after validating your information, allows you to use Equinix Metal servers for broadcasting your own IP blocks. Keep in mind that the smallest IPv4 block the internet will accept is a /24 (256 IPs).
  2. Use our Global Anycast IPs. This is the easy button on Equinix Metal that comes pre-packaged with optimal paths and allows you to use as little as one IP. The first method requires that you run open-source software called a BGP Daemon that can speak BGP to upstream routers. This isn’t required if you’re using Equinix Metal Global Anycast IPs, unless you are looking to run multiple servers in each data center.

There is a third method currently up for review on our feedback page, Use Your IPs as Equinix Metal Elastic IPs. This feature would allow you to use your IPs just like the Global Anycast IPs you can rent from us.  Consider upvoting the feature if you’re interested!

A step-by-step guide

If you’re ready to give this approach a try, here is a step-by-step guide showing how you can launch a global Anycast network on Equinix Metal leveraging our Global Anycast IPs. For this approach, you don’t need your own IPs or ASN, and can leverage user-data to configure your servers. As a result, in less than 5-minutes you can start balancing network traffic between global points of presence with built-in high availability.

Download: Deploying Global Anycast Network on Equinix Metal

Using your own IP’s and ASN

If you’re running in production and at scale across providers, you’ll want to consider using IP addresses that you own and control. You will also likely leverage battle-tested tools like BIRD or Quagga (or a fork of Quagga called FFR, or Free Range Routing) to announce your IP blocks to the world using your ASN. You can find some guides and documentation over at the Equinix Metal Developer Docs Site.

Once you get deeper into the world of BGP, take a look at our BGP Global Communities to learn can fine tune your network.

 

[i] CloudFlare Glossary, “What is BGP.”

[ii] Requesting IP Addresses or ASNs

Subscribe to the Equinix Blog