Properly Using Your Anycast IP Address

Anycast IP addresses aren't like normal IP addresses in the sense that they are announced from one location but rather more than one location, possibly even hundreds of locations. Therefore, caution must be taken when deploying an anycast IP address to ensure everything works perfectly, failure to do so will cause unavailability that is hard to track down and difficult to troubleshoot. Mean Servers has written this guide to help assist you in planning your anycast IP address deployment. By now, you will have read our first tutorial guide on the subject, Setup Your VPS Anycast IP Address. This article assumes you have setup your anycast IP address by following this guide and that your anycast services are with Mean Servers. This guide is meant as a general how-to only and may not be suitable for novices. Please consult an experienced server administrator before proceeding.

Determine Services Offered

First, you must determine what services you will be offering with your anycast IP address. Without a clear goal, you won't create anything usable or useful so before you even set out to get an anycast IP address, know what you want to accomplish first. Some general uses we see our anycast IP addresses being used for are:

  • DNS Services / Name Servers
  • Reverse Proxies
  • Web Servers
  • MySQL Servers

Traditionally anycast IP addresses have been used primarily for DNS servers. In the past few years, it has become more common to serve websites from the same IP address to lower latency and increase speeds to end users. Just because your idea isn't listed doesn't mean it can't be done, it just means it isn't as common. New ideas appear for using anycast IP addresses almost daily, if you can figure out how to make it work, it probably will work just fine.

The following are a few examples of services that are a poor candidate for anycast IP addresses without very good reason or with a lot of effort and thought to the back end:

  • Game Servers
  • Mail Servers (how you going to synchronize the mail since some will be delivered to one server and not the other)
  • Applications using database back ends that do not have the ability to synchronize (usually flat file databases)

Prepare Your Server

Install the services you require as you normally would. Nothing really is changed in this sense, it's the configuration that is key.

Plan Data Synchronization

The toughest part about getting anycast to work with web servers or MySQL servers is how to keep the content on all machines synchronized and the same at all times. How will you manage changes? Do you plan on having one master server which accepts writes while all other servers just act as a file system that just serves contents synchronized from the master? Will you run everything in a master-master setup, accepting changes across all locations and letting your back end software manage everything?

Most software that isn't custom written is only designed to work in a straight forward way, the machine it reads data from is usually the same machine that it will write data too. If you are using off the shelf PHP software, chances are you won't be able to tell the software to write to one specific server and read data from another. If you are writing your own custom program, you have more flexibility but the complexity remains high.

Our recommendation would be the following. This is just a general idea and feel free to make any changes you see fit.

Web & MySQL Server

Let's say you are running a WordPress website that you want available on all servers you have with Mean Servers. You have setup all the systems, installed MySQL and Apache and are ready to go? Now what? Here is a brief outline of the next steps to get your WordPress site synchronized between all servers and data consistently up to date. Luckily with WordPress, most changes are made via database which will make this setup pretty easy.

  1. Setup MySQL/MariaDB to be in a master-master configuration. This will allow changes to be made on either servers and propagate to the other. Allowing MariaDB/MySQL to manage synchronizing the data via a master-master setup is best because trying to edit WordPress to read from one server and write to another would be a nightmare.
  2. Determine which server will be your master file server. The master file server is where you will upload any PHP changes, static page changes, or image changes.
  3. Setup rsync to synchronize any changes made on the master server to all other servers so you do not need to make the same change on each server.
  4. Ensure your httpd.conf configuration files are serving content via the anycast IP address, not the normal IP address. This way, you can also rsync your httpd configuration files too.
  5. Setup rsync to synchronize your http configuration files and any SSL certificates you have.

One of the pitfalls of this is determining what IP address to use for synchronizing files. Obviously serving content will be via the anycast IP address and any configuration file where the data is to be served to the web should be set as such. Configuration files will need to have the normal IP address set when not serving the public. If you are sending files to your other VPS located in one of our other locations, use the normal address, not the anycast IP address. If you use the anycast IP address, you will just connect to the server that you are trying to send from defeating the whole purpose. Same thing when setting up the master-master MySQL settings. Each server should be connected to via their normal IP address, not the anycast IP address.

To keep it simple, think in these terms. If you are configuring a back end function, use the normal IP address. If you are configuring something the public should have access to, use the anycast IP address. When in doubt, test on a sandbox machine or consult an experienced server administrator.

Control Panel Considerations

Having a control panel is great if you aren't an experienced server admin and prefer a GUI for most tasks. However if you are dealing with an anycast IP address, it is best to just use bare bones and not a control panel instead. Although possible to use a control panel, there are a LOT of things to consider and configure in order to get everything working right, and even then, it probably won't work the way you want. It is best to avoid using a control panel with an anycast IP address unless you are 100% certain you know exactly what you are doing.

Network Availability Considerations

Mean Servers strives to make our anycast system the best out there but there are some limitations at this time. One of the biggest you should be aware of is that your IP address is only withdrawn if there is a severe network issue causing a routing issue between Mean Servers and our upstream providers, your IP address is under a DoS/DDoS attack, or we have remove the route from our network. Any other reason of unavailability will cause the route to remain announced. Since we use a routed version of anycast, we do have the ability to withdraw route but not automatically at this time. Without withdrawing the route, that means should your VPS become unavailable for whatever reason at one data center, whether that is because of a misconfiguration or the VPS is just offline, visitors being routed to that location will not have access to your services, even if the services are up at another location. We are working on a system that monitors for problems and automatically withdraws routes if it detects your VPS is unavailable but this system will not be ready until early 2016.

Other Notes

We will add additional information and examples to this guide as needed. This is just meant as a quick tutorial to get you thinking about what you can create with your anycast IP address and not an exhaustive list or how-to. Anycast is extremely complicated and planning should be done by an experienced professional. Mean Servers does provide complex systems consultation services on an hourly rate basis. Feel free to contact the sales department to get a quote or additional information. We can assist in setting up a simple 2 VPS anycast system to the more advanced, 100 VPS anycast system.
  • 58 Users Found This Useful
Was this answer helpful?

Related Articles

Setup Your Own Private VPN with PPTP

PPTP VPN IntroductionTired of being geo blocked and not being able to watch your favorite TV...

Protect DirectAdmin from Brute Force Attacks

A common method of gaining access over a server is to use a technique called a brute force...

Changing Your Server's Time Zone

Changing the time zone that your server is set to is relatively simple and straight forward. In...

Synchronizing Your Server's Clock

Synchronizing your server's clock is not very difficult as there is a program that can be ran by...

IPv4 Subnetting and Special Purpose IP Addresses

This reference sheet is intended as a quick use guide when working with IPv4. Although most...