Skip to content25% off at checkout on all products with annual billing
2 months %53 months %106 months %1512 months %25Discount applied at checkout

Linux

What Is a DDoS Attack? How It Works and Defense

Back to all posts

A DDoS (Distributed Denial of Service) attack is a deliberate attempt to make a server, service, or network unavailable by overwhelming it with traffic from many compromised devices at once. Unlike a data breach, the goal is usually service disruption or reputational damage, not stealing data. As a hosting provider, we see these attacks at different layers, and the response changes depending on the type and target.

How a DDoS Attack Works

The attacker sends commands to a botnet, which is a network of previously compromised devices such as routers, IoT devices, or servers. These devices all send requests to the target at the same time. The target burns CPU, memory, bandwidth, or its connection table while trying to process, reply to, or hold these connections open. Legitimate users are then queued or rejected. The size of the attack is not the only thing that matters; a small but well-crafted application-layer attack can exhaust a web server faster than a brute-force flood.

Types of DDoS Attacks

  • Volumetric attacks: Try to fill the target’s internet line. Examples include UDP flood, ICMP flood, and DNS amplification.
  • Protocol attacks: Target state tables on firewalls, load balancers, or servers. SYN flood is the classic example, creating many half-open connections.
  • Application-layer attacks: Aim to exhaust the application itself. HTTP flood and Slowloris look like real requests but consume more resources than normal users.

The common challenge is that legitimate and malicious traffic become difficult to distinguish, especially at the application layer.

Warning Signs of a DDoS Attack

Watch for these symptoms on your server:

  • Inbound traffic far above your normal baseline.
  • Hundreds or thousands of connections from a single IP or a small set of IPs.
  • Pages load slowly or time out even when CPU and memory usage are not extremely high.
  • The connection table fills up, and you see many SYN_RECV or similar states.

For live monitoring, iftop or nload shows real-time bandwidth use. tcpdump -i eth0 -n lets you inspect source addresses. To list the top talkers, use:

ss -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head

If the first lines show one IP with many more connections than the rest, investigate further. However, log analysis and traffic inspection are still needed for a reliable diagnosis.

How to Protect Your Server from DDoS Attacks

There is no single fix, but a layered defense reduces both the likelihood and impact.

  1. Kernel and firewall hardening: Enable SYN cookies and tune the backlog. Use iptables/nftables or a control panel firewall such as CSF to limit connections per IP.
  2. Application-layer rate limiting: Set per-IP request limits in Nginx, Apache, or your application. This stops many HTTP floods before they reach the backend.
  3. Reverse proxy and CDN: Offload static content to the edge and filter malicious traffic before it hits your origin.
  4. Resource isolation: On shared hosting, another customer’s attack can affect your site. Having your own virtual server provides isolated CPU and memory, which reduces that risk. Knowing how much RAM your server needs also helps you spot abnormal usage.
  5. Monitoring and alerting: Keep baselines for traffic, connection count, and resource use so anomalies trigger an alert instead of a silent outage.
  6. Keep software updated: Patching the OS, web server, and plugins closes known attack vectors.

For a basic SYN flood mitigation on AlmaLinux or Rocky Linux 9, create /etc/sysctl.d/99-ddos.conf with:

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.core.somaxconn = 4096

Apply it with sysctl -p /etc/sysctl.d/99-ddos.conf.

These settings limit half-open connections but will not stop a large volumetric attack by themselves. In our experience, a server with SYN cookies, per-IP connection limits, and application-layer rate limiting survives common flood attempts. For large attacks, the data center must step in with traffic scrubbing or null routing. If you are choosing a dedicated server, check the provider’s DDoS mitigation options before you buy. For game server hosting, downtime is especially visible, so DDoS protection should be part of the infrastructure decision.

What to Do After a DDoS Attack

After the attack ends, review your logs to identify the attack vector and source patterns. Patch the exposed weak point, tighten your firewall and rate limits, and adjust your monitoring thresholds. If the same IP address is targeted repeatedly, speak with your provider about changing the IP and adding upstream filtering.

ddosserver securitynetwork securitysyn floodlinuxrate limitingprotection
Back to all posts