Blog

How Anti-DDoS Protection Works for a VPS

VPS server protected against DDoS attacks

A DDoS (distributed denial-of-service) attack tries to take a website or server offline by flooding it with traffic from many machines at once. Anti-DDoS protection sits in front of the server, separates the attack traffic from real visitors and drops it, so the service can stay online.

This article explains the main types of attack, how protection filters them, what a DDoS-protected VPS is, what you can do on your own server, and what protection costs.

What is a DDoS attack?

In a denial-of-service attack, the attacker sends a target more traffic or requests than it can handle, so legitimate users can't reach it. In a distributed attack, the traffic comes from many machines at once, usually a botnet of computers, routers, cameras and other devices infected with malware. The Mirai botnet, for example, was built from Internet of Things devices that still used default passwords. With traffic from thousands of addresses, blocking one sender doesn't stop the attack.

Motives range from extortion and harming a business rival to activism or entertainment. A DDoS attack doesn't break into a server or steal data on its own, but while it lasts, customers can't buy, log in or use your service, and repeated outages cost sales and drive customers to competitors.

What is anti-DDoS protection?

Anti-DDoS protection, also called DDoS protection or DDoS mitigation, is the set of tools and services that detect a DDoS attack and filter it out, so that legitimate traffic still reaches your website or server. It can run on the server itself, on dedicated hardware in front of a network, or in the network of a hosting provider or a specialist service. Hosting with protection built into the provider's network is often called anti-DDoS hosting or DDoS-protected hosting. The rule of thumb: the bigger the attack, the further from your server it has to be stopped.

The three main types of DDoS attack

DDoS attacks are grouped by the part of the connection they target. Many attacks combine several types at once, so protection needs to cover more than one layer.

Volumetric attacks

Volumetric attacks try to use up all the bandwidth between the target and the internet. Common forms are UDP floods, ICMP floods and reflection or amplification attacks: the attacker sends small requests to public servers running services such as DNS, NTP or memcached, with the victim's address forged as the sender, and those servers send much larger replies to the victim. These attacks are measured in bits per second.

Protocol attacks

Protocol attacks exploit the way network protocols work to exhaust the resources of servers, firewalls and load balancers. In a SYN flood, the attacker sends a stream of requests to open TCP connections and never completes the handshake, so the server holds half-open connections until it has no room left for real ones. These attacks are measured in packets per second. Like volumetric attacks, they work at the network and transport layers, Layers 3 and 4.

Application-layer (Layer 7) attacks

Application-layer attacks target the website or application itself. An HTTP flood sends large numbers of GET or POST requests, often to pages that take a lot of work to build, such as search or login. A slow attack such as Slowloris opens many connections to a web server and keeps them open by sending each request very slowly, until no connections are left for real visitors. These attacks need far less traffic than a volumetric attack and look like normal visitors, which makes them harder to detect. They are measured in requests per second.

How DDoS protection works

Whatever the product, DDoS protection works in three steps:

  1. Detection: the system learns what normal traffic to a server looks like and watches for sudden changes in volume, packet rates, sources or protocols. Always-on protection inspects traffic all the time; on-demand protection is switched on when an attack is detected or reported.
  2. Diversion: traffic to the attacked address goes through the filters. A hosting provider can filter inside its own network, a scrubbing service takes the traffic over by changing internet routing (BGP), and a reverse proxy receives it because the website's domain points to the proxy.
  3. Filtering: attack traffic is dropped, and the clean traffic is passed on to your server.

Filtering techniques

  • Packet and protocol checks: malformed packets, and traffic that breaks its protocol's rules, such as connections that are never completed, are dropped.
  • Signatures and reputation: traffic that matches known attack patterns, or comes from addresses known for abuse, is blocked. Botnets change addresses constantly, so these lists must stay current.
  • Rate limiting: each source may send only so many packets, connections or requests in a given time. Limits based on normal visitor behavior stop floods without slowing real users.
  • Challenges and WAF rules: at Layer 7, suspicious visitors get a JavaScript challenge or a CAPTCHA, which real browsers and people pass and simple bots fail, and a web application firewall (WAF) blocks malicious HTTP requests.
  • Location-based filtering: during an attack, traffic from regions a service doesn't serve can be limited or blocked.

When an attack is too big: null routing

Every filter has a capacity. When an attack is larger than the protection in front of a server can absorb, providers protect the rest of their network by null routing, or blackholing, the attacked IP address: all traffic to it is dropped, attack and legitimate traffic alike. The server is offline until the null route is lifted, but the rest of the network stays up. Ask a provider about its null-routing policy before you need it.

Anti-DDoS software, hardware and network protection

Anti-DDoS products work at different points between the attacker and your server, so they stop different attacks.

Anti-DDoS software on the server

Software on your own server, such as firewall rules, connection and rate limits in the web server, or a WAF module, costs little and helps against small attacks and many Layer 7 attacks. But it only sees traffic once it has reached the server. A flood larger than the server's network connection fills that connection first, and nothing the server does can make room again.

A conventional firewall is not DDoS protection either: a stateful firewall tracks every connection, so a protocol attack can fill its connection table and make the firewall the bottleneck.

Anti-DDoS hardware

Dedicated mitigation appliances filter traffic at high speed in front of a network. They suit organizations that run their own networks, but they are expensive to buy, run and keep up to date, need specialist staff, and can still only filter what the internet connection in front of them can carry.

Protection in the hosting network

Protection built into a hosting provider's network, or bought from a specialist service, filters traffic at the edge of a large network, before it reaches the link to your server. For most websites and VPS servers, this is the layer that stops floods, while software on the server handles what is left.

What is a DDoS-protected VPS?

A VPS (virtual private server) is a virtual machine with its own operating system and root access, running on a physical host server alongside other VPS. On our VPS plans, CPU and RAM are shared on the host server; a hybrid server has dedicated CPU and RAM. A DDoS-protected VPS is one whose traffic passes through DDoS filtering in the provider's network before it reaches the VPS.

Where that filtering happens matters. A VPS reaches the internet through a network port of limited speed: up to 1 Gbps on our Linux VPS plans. An attack bigger than that fills the port before any software on the VPS sees the traffic, and because the host's network connection is shared with the other VPS on it, an unfiltered flood would hit them too. That is why a VPS has to be protected upstream.

How to protect your VPS from DDoS attacks yourself

You can't stop a large flood from inside a VPS, but you can make your server a harder target and keep small attacks from taking it down:

  1. Keep your server's IP address private. Put websites behind a reverse proxy, so attackers only see the proxy's address, and don't give your server's address away in DNS records for other services on it, such as a mail subdomain. If the address was public before, consider moving the site to a new one: see how to change the IP address of a Linux server.
  2. Close everything you don't use. Set the firewall to deny incoming traffic by default and open only the ports your services need, for example with nftables or ufw on Linux, or Windows Defender Firewall on Windows.
  3. Don't run open UDP services. A DNS resolver, NTP, memcached or SSDP service that answers anyone on the internet can be used to amplify attacks on others, so disable it or restrict it to your own addresses. This also keeps your VPS from taking part in attacks, which our Acceptable Use Policy forbids.
  4. Keep SYN cookies on. On Linux, the net.ipv4.tcp_syncookies setting lets the server keep accepting connections when its queue of half-open connections overflows during a SYN flood. The kernel's default is 1, which sends SYN cookies when that happens; check it with sysctl net.ipv4.tcp_syncookies.
  5. Limit connections and request rates. In nginx, the limit_req and limit_conn directives can limit how many requests per second and how many connections each IP address gets. In Apache, mod_reqtimeout sets timeouts and a minimum data rate for receiving requests, which closes slow connections of the Slowloris kind.
  6. Make expensive pages cheap. Cache what you can, and set tighter limits on pages that do heavy work, such as search and login.
  7. Know your normal traffic and have a plan. Monitor bandwidth, connections and requests, so you can tell an attack from a busy day, keep backups, and know how to reach your provider. At LyraHosting, open a ticket: technical support works 24/7/365, with a first reply within 1 hour.

What DDoS protection costs

DDoS protection doesn't have to be expensive. The price depends on what you need protected:

  • Included protection: many hosting providers include network filtering in the price of every server. It costs nothing extra and handles common floods, but above its limit the provider usually null-routes the attacked address.
  • Protection services: a reverse proxy for websites, or IP protection for a server, for a monthly fee that depends on the layers covered, the capacity behind the service, how many domains or addresses are protected and, with some services, how much clean traffic passes through.
  • Your own hardware: the most expensive route, because you pay for appliances, the network capacity in front of them and the staff to run them, whether you are attacked or not.

Always-on protection means paying for capacity on days without attacks; on-demand protection can cost less, but it isn't filtering yet when an attack starts. Weigh the price against what downtime costs you in lost sales and customers. For many small businesses, included protection plus a reverse proxy for the website is an affordable start; services that are attacked often, such as game servers, also need protection for their IP address.

What to look for in DDoS protection

  • Layers covered: Layer 3/4 protection against floods on your IP address, Layer 7 protection against attacks on your website, or both.
  • Automatic mitigation: whether the protection detects and stops attacks by itself or has to be switched on.
  • What happens above the limit: whether the provider null-routes an attacked address, and for how long.
  • What is covered: which IP addresses, domains and ports. Protection usually applies per address, so cover every address your service uses.
  • Support during an attack: how you reach the provider, and how fast they answer.
  • Realistic claims: no protection can promise to stop every attack, so be wary of offers that do.

DDoS protection at LyraHosting

Standard protection on every VPS and dedicated server

Our offshore Linux VPS, Windows VPS and dedicated servers run in three data centers in the Netherlands, and every one includes standard transit anti-DDoS protection, as do our storage VPS, hybrid servers and web hosting accounts. Our filtering recognizes attack patterns in real time and drops malicious traffic before it reaches your server. If an attack is larger than this protection can absorb, the IP address under attack is null-routed until the attack stops, usually for 24 to 48 hours, to protect the network (see our Acceptable Use Policy).

The protection comes with the plan: Linux VPS plans start at €8.99 a month, Windows VPS at €15.99 and dedicated servers at €99. When you need more, LyraShield DDoS protection adds dedicated mitigation in two plans.

LyraShield Reverse Proxy Web

For websites, at €19.99 a month. Point your domain at LyraShield, and every request is checked before it reaches your server: Layer 7 filtering with a web application firewall, JavaScript challenge and CAPTCHA, anycast DNS and up to 3 TCP ports. Attacks are mitigated automatically, your server's IP address stays hidden, and caching can make your website faster. It works even if your website is hosted elsewhere.

LyraShield Premium Anti-DDoS

For servers hosted with LyraHosting, at €200.00 a month. Premium combines the reverse proxy with hardware IP DDoS protection for your server's IPv4 address, which stops Layer 3 and 4 attacks such as SYN, UDP and amplification floods. Attacks are detected and mitigated automatically, so you don't have to switch protection on when one starts. Premium is backed by a mitigation capacity of more than 1.5 Tbps and 250 Mpps (million packets per second), based on clean traffic.

Choose Reverse Proxy Web to protect a website, wherever it is hosted. Choose Premium if your server is with us and its IP address also needs protection from network floods, for example for streaming services, or for game servers, which we allow on dedicated servers. The LyraShield DDoS protection page compares both plans and lists the attacks LyraShield defends against, from HTTP GET and POST floods to NTP, DNS and SSDP reflection. Under attack right now? Open a ticket, and our team will help 24/7/365.

Host it offshore with LyraHosting

Every offshore VPS includes standard anti-DDoS protection, with LyraShield available on top.