Search code examples
linode

How to prevent being affected by data-center DDoS attack & maintainance related downtime?


I'm hosting a web application which should be highly-available. I'm hosting on multiple linodes and using a nodebalancer to distribute the traffic. My question might be stupid simple - but not long ago I was affected by a DDoS hitting the data-center. That made me think how I can be better prepared next time this happens.

The nodebalancer and servers are all in the same datacenter which should, of course, be fixed. But how does one go about doing this? If I have two load balancers in two different data centers - how can I setup the domain to point to both, but ignore the one affected by DDoS? Should I look into the DNS manager? Am I making things too complicated?

Really would appreciate some insights.

Thanks everyone...


Solution

  • You have to look at ways to load balance across datacenters. There's a few ways to do this, each with pros and cons.

    If you have a lot of DB calls, running to datacenters HOT can introduce a lot of latency problems. What I would do is as follows.

    Have the second datacenter (DC2) be a warm location. It is configured for everything to work and is constantly getting data from the master DB in DC 1, but isn't actively getting traffic.

    Use a service like CLoudFlare for their extremely fast DNS switching. Have a service in DC2 that constantly pings the load balancer in DC1 to make sure that everything is up and well. When it has trouble contacting DC1, it can connect to CloudFlare via the API and switch the main 'A' record to point to DC2, in which case it now picks up the traffic.

    I forget what CloudFlare calls it but it has a DNS feature that allows you to switch 'A' records almost instantly because the actual IP address given to the public is their own, they just route the traffic for you.

    Amazon also have a similar feature with CloudFront I believe.

    This plan is costly however as you're running much more infrastructure that rarely gets used. Linode is and will be rolling out more network improvements so hopefully this becomes less necessary.

    For more advanced load balancing and HA, you can go with more "cloud" providers but it does come at a cost.

    -Ricardo
    Developer Evangelist, CircleCI, formally Linode