I have several servers with different IPs, deployed in different datacenters (mostly geographically close to our users). Let's imagine that this is simple web servers.

What I'd like to have is a single IP address for server so all users simple use it and it will route client to the nearest server.

I think using anycast address may help me. What I don't understand is

  1. Anycast, as I see, used (only) for DNS servers. I believe this is due to pretty simple (stateless) DNS protocol nature. Will anycast work for webservers? Will session that routed to one server stays connected to that only server (so, say, all keepalive requests be routed to the same server), or every request may go to different server?

  2. How can I implement anycast in practice? I understand I need an autonomous system (ok, I have one), then I need some server-state aware BGP announcer (so it will announce my anycast address only if/when the server is able to answer) - and I don't know what to use.

Did someone have any experience with anycast deployment? The idea is simple but I found too few information on its practical implementation.

Thank you in advance!

  • Just to clarify, you do have a ASN? – 3molo Apr 24 '12 at 9:22
  • 3
    At least: en.wikipedia.org/wiki/Anycast#Content_delivery_networks And the whole article has just everything (see links) you need to answer your questions by yourself. – poige Apr 24 '12 at 9:25
  • Why do you want a single IP address rather than single DNS name? – David Schwartz Apr 24 '12 at 10:13
  • In fact I want single hostname that points to the same (single) IP. What is a herd part for me is my application's session live time, I need to check that deeply. – Alexander Apr 24 '12 at 13:49

You need to have a ASN. You can't really announce less than a /25 network. There is no guarantee that any session will go over the same route, but most will likely use the same paths.

That is however not relevant for the application sessions, as the routers are not session aware - they simply forward packets regardless of states/types/flags. Anycasting is used for all types of services.

The users will end up on the server (or loadbalancer) that holds the IP, it has nothing to do with which server it ends up at. If client talks to server, client will always communicate with regardless of how it was routed on the internet or intranet.

The router is not "server-state aware", and it announces networks - not individual IP's. It will not know or care if the server is able to respond, I think you are confusing it with a load balancer (like IPVS, HAproxy).

In case you're not confusing it, then you need multiple transit providers that announce your network (or part of it, at least /25). If you are colocated, you can simply ask your providers to announce your networks. I think the function for announcing a customers ASN is by the AS-SET information, but I am a little unsure about that.

  • I have an ASN, and PI IPs, but I'm fuzzy about if I can use any network as anycast one (or I need to specifically get anycast-range IPs). – Alexander Apr 24 '12 at 13:44
  • Well the bad news is I need router that client-server session state aware - or just forget about (since syncing sessions between server will be sophisticated and won't easy my life :) ). Loadbalancer won't helo as I want to have servers in different places, not in the same rack. – Alexander Apr 24 '12 at 13:47
  • Im not sure you do, but maybe I don't understand you correctly. What kind of sessions are we talking about? TCP? Http application (aka cookie)? – 3molo Apr 24 '12 at 14:20
  • Noop. We have some application server used in the company, the sessions are short (1-5 secs), but I'm not sure what happened if it'll be divided between different servers that are under same anycast IP. Client won't be able to distinct if this is the same server or not (which is intended) but this way it won't be able to restart session. – Alexander Apr 24 '12 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.