What Is a DDoS Attack? How to Protect Your Server from DDoS Attacks
Your website suddenly stopped loading and your server's network graph went through the roof, yet your visitor numbers didn't actually increase. One of the most common causes of this picture is a DDoS attack. The good news is that with the right infrastructure and a few basic measures, most of these attacks can be neutralized without anyone noticing.
In this guide, we explain what a DDoS attack is, the most common attack types, how to tell you're under attack, the measures you can take to protect your server and the steps to follow during an attack.
DDoS (Distributed Denial of Service) is when fake traffic is sent to a server or network from many devices at once so that the service can no longer respond to real users. The goal isn't to steal data but to make the service unavailable. The most effective protection is to use infrastructure with network-level DDoS protection that filters traffic before it reaches your server, backed up on the server side by a firewall, rate limiting and up-to-date software.
What Is a DDoS Attack?
In a DDoS attack, the attacker uses a botnet, usually made up of thousands of malware-infected computers, servers, modems and IoT devices (cameras, smart home devices, etc.). These devices send requests or packets to the target server at the same time, filling up the server's bandwidth, processing power or connection tables.
As a result, the server can no longer distinguish or process requests from real visitors. Your website slows down, throws timeout errors or becomes completely unreachable. Attacks can last from a few minutes to waves lasting days, and they are carried out for different reasons, from rivals' jealousy to ransom demands.
A DDoS attack on its own doesn't give access to your data; its target is service continuity. However, some attackers may use DDoS as a smokescreen to distract attention from another attack. That's why reviewing system logs after an attack is good practice.
The Difference Between DoS and DDoS
Both attacks have the same goal; the difference lies in the source of the traffic:
| Feature | DoS | DDoS |
|---|---|---|
| Source | A single device or IP address | Thousands of different devices and IP addresses |
| Blocking | Relatively easy to stop by blocking the source IP | Blocking individual IPs isn't enough because the traffic is distributed |
| Volume | Limited | Can reach gigabits of traffic and millions of packets per second |
| Protection | A server firewall is often enough | Requires network-level filtering |
Types of DDoS Attacks
DDoS attacks fall into three main groups depending on the layer they target:
Volumetric attacks
The goal is to saturate the bandwidth of the server or the data center connection. UDP floods and DNS / NTP / Memcached amplification (reflection and amplification) attacks belong to this group. In reflection attacks, the attacker sends small spoofed requests to open services using the target's IP address; the services send much larger responses to the target. Their size is usually measured in Gbps (gigabits per second).
Protocol attacks
These exploit weaknesses in how network protocols work and exhaust the connection table of the server or firewall. The best known is the SYN flood: the attacker sends a large number of connection-initiation (SYN) packets but never completes the handshake. While the server allocates memory for the half-open connections, there's no room left for real users. These attacks are usually measured in pps (packets per second).
Application layer attacks (Layer 7)
HTTP GET/POST requests that look like a real visitor are sent to the website. Pages that put a heavy load on the database, such as search, cart or login pages, are targeted in particular. The traffic volume may be low, but because each request puts a serious load on the server, the site goes down. This is the hardest type to distinguish from normal traffic, and it is measured in rps (requests per second).
How Do You Know You're Under Attack?
Not every slowdown is a DDoS attack; heavy campaign traffic or software bugs can show similar symptoms. If you see the following signs together, an attack is likely:
- A sudden traffic spike: A vertical jump in the network graph while your visitor analytics show no increase.
- Concentration from one source: A large number of requests from the same IP range, the same country or with the same browser information (user agent).
- Hammering a single page: Hundreds of requests per second to a specific URL in the access logs.
- A full connection table: A large number of connections waiting in the SYN_RECV state.
- Other services affected too: SSH, RDP or email slowing down along with the website.
On a Linux server, you can use the following commands to see the current state:
# Summary of connection states
ss -s
# Top 10 IP addresses by number of connections
ss -ntu | awk 'NR>1 {print $6}' | cut -d: -f1 | sort | uniq -c | sort -rn | head
# Number of half-open (SYN) connections
ss -n state syn-recv | wc -l
# IPs with the most requests in the Nginx access log
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
Tools such as iftop, nload or vnstat can also be used to see the live traffic on the network interface. On Windows servers, the Performance tab in Task Manager and the netstat -an command provide similar information.
How Does DDoS Protection Work?
By the time a large-volume attack reaches your server, it's already too late: your connection is already saturated, and no matter how good the firewall on the server is, it can't stop the traffic. That's why effective DDoS protection handles traffic before it reaches the server, at the data center or network provider level.
- Monitoring: Incoming network traffic is continuously analyzed and a normal traffic profile is built.
- Detection: Traffic that deviates from the profile, matches known attack signatures or exceeds thresholds is flagged as an attack.
- Scrubbing: The traffic is passed through filtering devices; spoofed packets, reflection traffic and malformed connections are removed.
- Delivery: The clean, legitimate traffic is forwarded to your server. Your visitors usually notice nothing.
For application layer (Layer 7) attacks, smarter filters such as a web application firewall (WAF), rate limiting and bot verification come into play in addition to this protection. For sites serving visitors in Turkey, having the protection in a domestic location also keeps latency low; we covered this in detail in our article benefits of a Turkey-based server.
Measures to Protect Your Server
Choose DDoS-protected infrastructure
This is the most important measure. Ask your provider whether your server or hosting service includes network-level DDoS protection, and whether the protection is always on or only kicks in during an attack. The quality of the data center's infrastructure is also decisive; for details, see our Tier 3 data center guide.
Close unnecessary ports
Only expose the services you need. Leaving unused DNS, NTP or Memcached services open to the internet also means your server can be used in reflection attacks against others. A simple rule set with UFW on Linux:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp # SSH (use your own port if you changed it)
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose
If possible, open management ports (SSH, RDP, panel) only to your own IP addresses. For Windows servers, see our guide to changing the RDP port and improving its security; for a new Linux server, see our article the first 10 things to configure on a new Ubuntu VDS.
Improve SYN flood resistance with kernel settings
The SYN cookies feature lets the server keep accepting new connections even when the connection table is full. It's enabled by default on most current distributions; to check it and make it permanent:
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_synack_retries = 2
# To apply the settings:
sudo sysctl --system
Apply rate limiting on the web server
Limiting the number of requests from the same IP is effective against application layer attacks. An example configuration for Nginx:
# Inside the http { } block:
limit_req_zone $binary_remote_addr zone=istek:10m rate=10r/s;
limit_conn_zone $binary_remote_addr zone=baglanti:10m;
# Inside the server { } or location { } block:
limit_req zone=istek burst=20 nodelay;
limit_conn baglanti 20;
Adjust the values to your site's normal traffic; limits that are too low can block real visitors too. After the change, test the configuration with sudo nginx -t and apply it with sudo systemctl reload nginx. Fail2ban is also a useful complement against brute-force attempts.
Use caching and keep your origin IP hidden
Page caching and a CDN reduce the impact of Layer 7 attacks by preventing every request from reaching the database. If you're behind a CDN or proxy, be careful not to expose your server's real IP address in DNS records, email headers or subdomains. We explained how DNS records work in our DNS guide.
Plan resources and monitor
A server running at its limit goes down even under a small attack. Leave headroom in CPU, RAM and bandwidth, and use a monitoring system that sends alerts for traffic and resource usage. If the slowdown isn't caused by an attack, our guide explaining why your site is slow can point you in the right direction.
What to Do During an Attack
- β I assessed the situation calmly: I checked the network graph, connection counts and access logs.
- β I sent the attack's start time, the target IP and my observations to my provider's support team.
- β I blocked clearly attacking IP ranges and suspicious user agents in the firewall.
- β I tightened rate limiting on the pages under attack and enabled caching.
- β I kept the logs to review later.
- β After the attack ended, I reviewed the system logs for any other intrusion attempts.
Some attackers send ransom emails saying "pay or we'll escalate the attack". Paying doesn't guarantee the attack will stop and makes you a target again. Instead, contact your provider and, if necessary, report it to the authorities.
Frequently Asked Questions
Are DDoS attacks legal?
No. Launching a DDoS attack on a system, or buying a service for that purpose, is considered a cybercrime in many countries, including Turkey.
Can a small website be hit by a DDoS attack too?
Yes. Because DDoS services are cheap and easy to get, small businesses, e-commerce sites and game servers become targets too. A significant share of attacks are driven by competition or personal grudges.
Will the firewall on my server stop DDoS?
It can mitigate some small and application layer attacks. However, volumetric attacks that exceed your connection's capacity must be stopped before they reach the server, and that's only possible with network-level protection.
Does DDoS protection slow down the site?
Properly configured protection running close to your visitors doesn't add noticeable latency under normal conditions. During an attack, it keeps your site online.
How long does an attack last?
Most attacks last from a few minutes to a few hours, but there are also campaigns that recur at intervals for days. That's why it's important for protection to be always on.
Conclusion
DDoS attacks can cause both revenue and reputation loss by making your service unavailable. The most effective defense against most attacks is network-level protection that filters traffic before it reaches your server. Back it up by closing unnecessary ports, with server-side measures such as SYN cookies and rate limiting, with caching and with regular monitoring, and your infrastructure becomes far more resilient to attacks.
Netiyo VDS and dedicated servers run on Turkey-based infrastructure with DDoS protection, KVM virtualization and full root / administrator access. Choose the plan that fits your project, or explore our dedicated server options for higher performance.
Explore DDoS-Protected VDS Plans