What is a DDoS attack?
A DDoS (Distributed Denial of Service) attack floods a server, website, or network with more traffic than it can handle, until legitimate users can no longer reach it. The traffic arrives from many sources at once, often thousands of compromised devices in a botnet, which is why "distributed" is in the name. Any service that has to stay online, such as an online shop, an API or a game server, needs a plan for floods.
Common types of DDoS attacks
- Volumetric floods: UDP, ICMP, or DNS amplification that saturate your bandwidth (measured in Gbps).
- Protocol attacks: SYN floods and similar, which exhaust connection tables on firewalls and load balancers (measured in packets per second).
- Application layer (Layer 7): floods of HTTP GET/POST requests that look almost like real users and target expensive pages, search, or login.
How to tell you are under attack
Sudden latency, timeouts, or a spike in traffic with no marketing reason are the first signs. On a Linux server you can inspect live connections:
# count connections per client IP
ss -ntu state established | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
# watch inbound traffic on the interface
watch -n1 'cat /proc/net/dev'
If one or a few addresses hold hundreds of connections, or requests hammer a single URL, you are likely dealing with an attack rather than organic load.
How to stop a DDoS attack
1. Filter obvious sources at the firewall
Block or rate limit abusive addresses while you investigate:
# drop a single abusive source iptables -A INPUT -s 203.0.113.10 -j DROP # limit new connections per source on port 443 iptables -A INPUT -p tcp --dport 443 -m connlimit --connlimit-above 50 -j DROP
2. Rate limit at the web server
For Layer 7 floods, nginx can cap requests per client:
limit_req_zone $binary_remote_addr zone=web:10m rate=10r/s;
server {
location / {
limit_req zone=web burst=20 nodelay;
}
}
3. Ban repeat offenders automatically
Fail2ban reads your logs and blocks addresses that cross a threshold, which helps against slow application floods that stay under raw traffic limits.
4. Move filtering upstream
A large volumetric attack fills your uplink before your server ever sees a packet, so local rules cannot help. That traffic must be filtered before it reaches you, at the network edge. This is what dedicated DDoS protection and traffic scrubbing do: clean the traffic upstream, forward only legitimate requests, and keep your bandwidth free.
What to ask before you order a server
Before you order, ask the provider whether any filtering sits in front of the server, how much attack traffic it can take, what happens to your IP address during a large flood and whether any of this costs extra. Get the answers in writing, because "DDoS protection" on one price list can mean something quite different on another. The same applies to CloudHosting: if your project is likely to draw attacks, tell us before you order, and we will say plainly what we can and cannot do for it, so you decide before paying. We monitor the network around the clock, and on working days 9:00-17:00 Riga time our engineers help set up firewall rules and rate limits for your application.
Practical takeaway
Handle small floods yourself with firewall rules, nginx rate limiting, and fail2ban, but do not rely on the server alone. Anything large has to be stopped upstream, so for any service you cannot afford to lose, find out before ordering whether and where that traffic gets filtered and how much the filtering can take, and keep monitoring so you notice the attack in minutes, not hours.