Anycast is a technique to announce a single IP block from multiple locations, and let the routers connect people to the “nearest”.
Building a simple Anycast setup means acquiring IPs and then “announcing” them using BGP.
The first stop is a Regional Internet Registry (RIR). There are five. We registered with RIPE NCC, the European RIR. This was a quirk, at the time they still had IPv4 space to hand out. If not for that, we’d have used ARIN (the North American RIR). ARIN is a safe default, but you can totally read up on RIR options and choose one of the others. Note that all of them charge a $500+ annual membership fee.
Getting IPv4 blocks is an adventure. There are only 4.3 billion IPv4 addresses and they’re all owned by someone. So you’ll have to buy or lease an IPv4 block to do your own IP announcing.
IPv6 addresses are easy to get. There are 340 trillion, trillion, trillion IPv6 addresses. This is good news. IPv6 addresses are worthless and your RIR will happily just give you a block. If you want to fiddle around, start with IPv6 and just skim the next few paragraphs.
If you do want IPv4 addresses, the easiest way to get them is to find a broker. We used an auction site run by Hilco Streambank to buy ours because we don’t like talking to people. You might prefer a company like Prefix Broker for a more full service option.
You need to worry about two things when you’re purchasing IPs. First, make sure they’re either registered with your RIR, or they’re transferrable to your RIR. Once again, RIPE and ARIN registered IPs are safe choices.
And do some diligence to make sure they aren’t on abuse lists, like Spamhaus. IPs carry some of their history with them, if they’ve ever been used for spam you run the risk of having your own service blocked. Or if they’ve been blocked in China, you won’t be able to serve Chinese users. You will probably be ok but it’s worth doing a little digging.
To announce your own blocks, you need a minimum of an IPv4 /24
(256 IPs) or an IPv6 /48
(1,208,925,819,614,629,174,706,176
IPs). If this is the first time you’re seeing /24
and /48
, it’s worth reading up on CIDR notation.
An IPv4 valuation interlude
The going rate for smaller IPv4 blocks currently is ~$25 per IP address. This will change, the prices have gone up ~30% in the last 8 months.
Did you know big cloud providers publish their IP ranges? They do this because it’s useful for some infrastructure to know ahead of time. It’s also useful if you want to, say, guess how much wealth-in-IP-form they’re sitting on. You could even write a Ruby script to tell you:
Provider | Blocks | Total IPs | Estimated Value |
---|---|---|---|
AWS | 3,008 | 55,708,181 | ~$1,392,704,525 |
Google Cloud | 388 | 7,582,976 | ~$189,574,400 |
DigitalOcean | 1,581 | 2,368,896 | ~$59,222,400 |
These estimates are low. IPs are more expensive in bulk. AWS’s average IP blocks include ~18,000 IPs, close to a /18 block – which is 5-10% more valuable than a /24.
Are you really after easy mode?
You’ll need an Autonomous System number (ASN). An Autonomous System is a group of IP prefixes with routing definitions. An ASN is a number your registry (ARIN, RIPE, etc all) assigns so you can group your IPs together.
You don’t strictly need an ASN since you can find a hosting provider and piggyback on theirs, but they’re free from RIPE and relatively easy to setup. They’ll also let you do Anycast on hard mode. Which we are not interested in. Life is too short.
Remaining:
- BGP setup, communities, other hard stuff to vaguely know about but avoid
- What can go wrong
- DNS for traffic direction