DDoS protection: how to defend a website, layer by layer
DDoS protection is the set of measures that keep a website or service available while an attack tries to overwhelm it. No single product provides all of it, because attacks aim at different limits: the link, the connection tables, or the application. Protection means covering each of those limits, and deciding in advance who acts when an attack starts.
Quick facts
- Goal
- Keep the service reachable for real users during an attack
- Three layers
- Network capacity, connection handling, request filtering
- Who is involved
- Your network or hosting provider, your CDN or edge, and you
- Prepared in advance
- Contacts, runbook, monitoring and a tested way to switch defences on
- What a WAF covers
- Application-layer attacks only; floods that fill a link are stopped before requests exist
The structure follows the joint guide from CISA, the FBI and MS-ISAC, Understanding and Responding to DDoS Attacks: before an attack, during it, and after it.
Three layers of DDoS protection
- Network capacity and filtering. Volumetric floods fill the link to your site. Only capacity in front of that link helps: your provider's network, a scrubbing service, or an edge network with more bandwidth than the attack. See volumetric attacks.
- Connection handling. Protocol attacks fill the tables that track connections. SYN cookies, connection limits and devices built to hold many connections absorb them; see protocol attacks.
- Request filtering and rate limits. Application-layer attacks send valid requests that are expensive to answer. A web application firewall and rate limiting handle them; see application-layer attacks.
Each layer is blind to the others' problems, which is the point of attack layers: a filter that reads requests cannot help when the link is already full.
How to prevent DDoS attacks from taking you offline
An attack cannot be prevented from being launched; what can be prevented is the outage. Preparation is most of it.
- Know what matters. List the services that must stay up and what each depends on: DNS, the origin servers, third-party APIs.
- Know who carries your traffic. Have the provider's emergency contact and know what they can filter on request.
- Put capacity in front of the origin. An edge network or scrubbing service absorbs floods your own link cannot; hide the origin's address so traffic cannot bypass it; for a single machine, see servers and VPS.
- Filter and limit at layer 7. Rate limits and request filtering, introduced in monitor mode first so they do not refuse customers.
- Write the runbook. Who decides, who calls whom, which switches exist, and how to reverse each one.
If a DDoS attack is under way now
- Confirm it is an attack. Rule out a deployment, a campaign or a broken integration; check your provider's status.
- Find which limit is exhausted. A full link, full connection tables, or overloaded servers point to different measures.
- Call your provider. For floods that fill the link, they are the only ones who can filter upstream of you.
- Tighten layer 7 deliberately. Rate limits on the targeted paths and stricter filtering, each change noted so it can be undone.
- Record and review. Keep timelines and logs; after the attack, decide what to change before the next one.
The discipline for emergency changes you can unwind is on incidents.
After an attack: what to change
Review the attack while it is fresh. Note which limit was reached first, how long it took to notice, which calls were made and how long the provider took to act. Those numbers show where the time went.
Then reverse the emergency changes one at a time, and keep the ones that proved useful as deliberate settings. Update the runbook with what was missing, and test the parts you rely on, such as switching filtering on or reaching your provider, before you need them again.
Choosing DDoS protection
Ask any provider the same questions, without relying on comparison tables that age quickly. The classes of solution are compared on cloud vs on-premise, and the steps once an attack starts on DDoS mitigation.
- Which layers does it cover? Network floods, protocol attacks, application attacks, or only one of them.
- Where does filtering happen? Upstream of your link, at an edge network, or on your own servers.
- How is it switched on? Always on, or diverted when an attack is detected, and how long that takes.
- What do you see? Logs of what was refused, and whether you can watch decisions before they are enforced.
Questions
What is DDoS protection?
DDoS protection is the set of measures that keep a service available during a distributed denial-of-service attack: network capacity for floods, connection handling for protocol attacks, and request filtering and rate limits for application attacks.
How do I stop a DDoS attack?
Confirm it is an attack, find which limit is exhausted, ask your network provider to filter floods upstream, and tighten rate limits and filtering at layer 7 for application attacks. Record each change so it can be reversed.
Can a firewall stop DDoS attacks?
A web application firewall stops application-layer attacks, which arrive as requests. It cannot stop floods that fill the network link before requests exist; those need capacity and filtering in front of it.
Can small websites get DDoS protection?
Yes. Placing a site behind an edge network or CDN gives it capacity it could not afford alone, and rate limits at layer 7 protect expensive pages and forms.