Blog | G5 Cyber Security

DigitalOcean DDoS Protection

TL;DR

For basic to medium DDoS attacks on DigitalOcean, using Cloudflare’s free plan is often the best starting point. For larger or more sophisticated attacks, consider a paid service like Cloudflare Pro, Akamai, or Imperva.

1. Understand Your Needs

Before choosing a solution, figure out what kind of DDoS attacks you’re likely to face:

Also consider the size of attacks you need to mitigate – a small blog has different requirements than an e-commerce site.

2. Cloudflare Free Plan

Cloudflare is a popular Content Delivery Network (CDN) that offers excellent DDoS protection, even on its free plan. It’s easy to set up and provides good basic protection:

  1. Sign Up: Create a Cloudflare account at https://www.cloudflare.com.
  2. Add Your Site: Enter your DigitalOcean server’s domain name.
  3. DNS Records: Cloudflare will scan your existing DNS records. Verify they are correct.
  4. Change Nameservers: Update your domain’s nameservers at your registrar (where you bought the domain) to point to the ones provided by Cloudflare. This is crucial! It can take up to 48 hours for changes to propagate.
  5. Enable Protection: Once DNS propagation is complete, Cloudflare will start protecting your site. Check the Cloudflare dashboard for attack statistics and settings.

Cloudflare automatically filters malicious traffic before it reaches your server.

3. DigitalOcean’s Built-in Protection

DigitalOcean provides some basic DDoS protection as part of its infrastructure, but this is generally not sufficient for sustained or large attacks. It’s a first line of defense, but you’ll likely need more robust solutions.

4. Cloudflare Pro (Paid)

If the free plan isn’t enough, consider upgrading to Cloudflare Pro. This offers:

Pricing starts around £17 per month.

5. Other Paid DDoS Protection Services

Several other providers offer dedicated DDoS protection:

These services typically require more technical setup and configuration.

6. Using iptables (Advanced)

If you’re comfortable with the command line, you can use iptables on your DigitalOcean server to block specific IP addresses or traffic patterns. However, this is a manual process and not scalable for large attacks.

sudo iptables -A INPUT -p tcp --dport 80 -m limit --limit 10/second --limit-burst 20 -j ACCEPT

This example limits incoming connections on port 80 to 10 per second. Be very careful when using iptables, as incorrect rules can block legitimate traffic.

7. Monitoring and Alerting

Regardless of the solution you choose, it’s important to monitor your server for suspicious activity. DigitalOcean provides basic monitoring tools, but consider using a third-party service like:

Exit mobile version