DDoS protection for servers and VPS: yours and your host's part
A single server or VPS has one network link and one address, which makes it easy to overwhelm: a flood larger than the link takes it offline no matter how it is configured. Protecting it is a split job. The hosting provider decides what happens to floods before they reach the machine; you decide whether the server's address is exposed, what it listens on, and how it behaves under load.
Quick facts
- Main weakness
- One link and one public address
- What the host can do
- Filter or absorb floods upstream, or blackhole the address
- What you can do
- Hide the address, close unused ports, tune connection handling, limit requests
- Biggest single step
- Put the website behind an edge network and keep the server's own address private
- Out of scope here
- Game servers and other UDP services, which need provider-specific filtering
The general picture of layered defence is on DDoS protection.
What your hosting provider filters
Hosting offered as DDoS protected usually means the provider filters floods upstream of your server, up to some size and for some attack types. Below that size, traffic is cleaned; above it, many providers blackhole the address, which takes the server offline to protect their other customers.
Ask the provider what the threshold is, which families are filtered, whether filtering is always on, and what happens when the limit is passed. Those answers matter more than the label on the plan.
DDoS protection for hosting takes two forms: the provider filters traffic on its network before it reaches your machine, or an edge network answers for the site. Web hosting DDoS protection of the first kind covers the address the provider assigned to you, not a second address that leaks around it, such as an old DNS record.
To compare a server with DDoS protection against a plain one, check:
- Which layers are covered. Network and protocol floods only, or HTTP requests as well.
- What is protected. The whole server, or one account on it.
- What happens past the limit. Filtering continues, traffic is restricted, or the address is blackholed.
To protect a server from DDoS where the plan covers only some of this, keep the address private and limit requests, as described below.
Shared hosting, VPS and dedicated servers
On shared hosting, many sites share one server and one address. An attack on a neighbour can take your site down with it, and the host is likely to protect the server as a whole rather than your site. Moving the site behind an edge network is the most effective step you can take on your own.
A VPS shares a physical machine but has its own address, so floods against it are yours alone, and so is the decision to hide it. A dedicated server adds control over the network card and kernel settings, but the link in front of it is still the limit; the provider's upstream filtering matters as much as on any other plan.
VPS hosting with DDoS protection
To protect a VPS from DDoS, split the work the same way as for any server. VPS hosting with DDoS protection puts filtering on the provider's network, before traffic reaches the virtual machine; a DDoS protected VPS hosting plan says nothing about what the machine itself exposes. If the address is published in DNS or has leaked, a flood can still be sent straight to it.
Before choosing VPS hosting DDoS protection, put the same questions to the provider as on any plan: the size at which filtering stops, the attack types covered, and whether the address is blackholed above the limit. A DDoS protected VPS server whose plan answers these clearly is easier to plan around than one that only carries the label. Then do your part: hide the address, close unused ports and set request limits.
Dedicated server hosting with DDoS protection
A dedicated server with DDoS protection is a machine whose provider filters floods on the link in front of it. Dedicated server DDoS protection does not remove the link as the limit: a flood larger than the link is a problem whatever hardware sits behind it.
When comparing dedicated server hosting with DDoS protection, check whether filtering is always on or starts after an attack is detected, whether it covers the whole server or one address, and what you can see of the traffic that was filtered. A DDoS protected dedicated server hosting plan that leaves these open gives you a label, not a limit you can plan around.
Dedicated hosting with DDoS protection also leaves the server-side steps to you: keep the address private behind an edge network and apply the settings below. Dedicated server hosting DDoS protection is the provider's filtering plus those steps, not either alone.
Hide the origin server's address
A website served through an edge network or CDN is reached at the network's addresses, not the server's. If the server's own address stays private, attackers have to go through the network; if it leaks, they can flood the server directly. Bridge CDN is the network this site belongs to.
- Accept web traffic only from the edge network. Refuse direct connections on ports 80 and 443.
- Check old DNS records. Historical records and subdomains often still point at the server.
- Watch what the server sends out. Email headers and outbound requests can reveal its address.
- Change the address if it has leaked. Protection that can be bypassed is not protection.
Server settings that help
- Close what you do not use. Every open port is something to flood; a firewall that allows only needed services removes them.
- Keep management off the public internet. SSH and admin panels behind a VPN or an address allowlist; see IP blocking.
- Turn on SYN cookies. They keep a SYN flood from filling the connection table.
- Set timeouts for slow clients. Short header and body timeouts blunt Slowloris-style attacks.
- Limit requests per client. On the web server or in front of it, for expensive paths first.
None of these raises the size of the link. They make the server last longer against small attacks and fail less badly against larger ones.
Autoscaling and the bill
On cloud servers that add capacity automatically, an application-layer flood may not take the site down at all. It makes the platform start more servers, serve the attack, and charge for it. The outage becomes an invoice.
Set an upper limit on how far automatic scaling can go, an alert on spending, and rate limits in front of the expensive paths, so a flood is refused before it reaches the part that scales. The same applies to bandwidth billed by volume, which a flood consumes whether or not the server keeps up. How request floods work is on HTTP flood.
Testing your setup before an attack
If the server sits behind a protection service, check that it cannot be reached around it. From an outside network, connect directly to the server's address with your site's name in the request; if the site answers, so will a flood sent straight to it. The origin should accept web traffic only from the service's addresses.
Then check the leaks that reveal the address: old DNS records and subdomains pointing at it, mail sent from it, and outbound requests made by the application. Repeat the check after moving servers or adding a subdomain, since that is when the address usually escapes.
If your server is under attack now
- Contact the host first. Only they can filter what fills your link.
- Check whether the origin address is the target. If the attack bypasses your edge network, the address has leaked.
- Tighten request limits on the targeted paths, and note each change so it can be undone.
- Move the site behind an edge network if it is not already, and change the server's address.
Detection and response in more detail are on DDoS mitigation; the signs of an attack are on DDoS attack detection, and the choice between cloud and on-premise filtering on cloud based DDoS protection.
Questions
How do I protect my VPS from DDoS attacks?
Choose a host that filters floods upstream, put websites behind an edge network and keep the server's address private, close unused ports, enable SYN cookies, set timeouts and limit requests per client.
Is DDoS protected hosting worth it?
It helps against floods up to the provider's threshold. Ask what the threshold is, which attacks are filtered, and whether the address is blackholed above it.
Why does my server go offline even with a firewall?
Because a flood larger than the link is dropped before the server's firewall sees it. That traffic has to be filtered upstream.
What does web hosting with DDoS protection cover?
Floods that the provider filters upstream, up to its own threshold and for the attack types it lists. It does not cover an exposed origin address, or request floods that the plan does not name. Check the threshold, the layers and the action taken above the limit.
What should dedicated server hosting with DDoS protection include?
At least a stated threshold, the attack types that are filtered and the action taken above the limit. Whether filtering is always on and whether it covers the whole server are the next things to ask.
How do I protect a server from DDoS if my host offers no protection?
Put the website behind an edge network, keep the server's address private and close unused ports. A flood larger than the link cannot be stopped from the server side, so ask the host what happens when one reaches it.