Skip to content
Log In Sign Up info@muvcloud.com

DoS and DDoS

A denial-of-service (DoS) attack comes from one source. Blocking that one address usually ends it. A distributed attack (DDoS) comes from thousands of addresses at the same time, often spread across many networks and countries, so blocking single sources by hand does not keep up.

Botnets and Amplification

  • Botnets: networks of compromised computers, routers, cameras, and other devices that an attacker controls remotely and directs at one target.
  • Reflection and amplification: the attacker sends small requests with a forged source address to public services, such as open DNS resolvers or badly configured NTP or memcached servers. Each service sends a much larger answer to the forged address, which is the victim.

The second point is also a reason to keep your own server tidy: a DNS resolver or other UDP service open to the whole internet can be used against someone else.

The Three Main Types

TypeWhat it exhaustsExamples
VolumetricBandwidth of the linkUDP floods, amplification
ProtocolConnection and state tablesSYN floods, fragment floods
Application layerWeb server, application, databaseHTTP floods, slow requests

Volumetric attacks are measured in bits per second, protocol attacks in packets per second, and application-layer attacks in requests per second. An application-layer attack can be small in bandwidth and still stop a site, because each request makes the server do expensive work.

How an Attack Looks from the Server

  • Load: uptime and top show high load or CPU use without a matching rise in real visitors.
  • Connection counts: far more open or half-open connections than usual.
  • Logs: the web server's access log fills with the same URL, the same user agent, or requests from many unfamiliar addresses.
  • Errors: the site answers slowly or with 503 Service Unavailable.
  • Nothing at all: in a large volumetric attack the link is full before traffic reaches the server, so the server looks calm while nobody can reach it.

Commands to Look Closer

uptime
ss -s
ss -Htn state syn-recv | wc -l
ss -Htn state established | awk '{sub(/:[^:]*$/, "", $NF); print $NF}' | sort | uniq -c | sort -rn | head

The first ss command summarizes sockets, the second counts half-open connections, and the last lists the addresses with the most established connections. -H leaves out the header line, and the awk part strips the port from the peer address in the last column. For the web server's view:

sudo awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
sudo awk '{print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

These show the busiest client addresses and the most requested URLs. The awk command guide explains the fields.

Not Every Spike Is an Attack

A link shared on a busy site, an aggressive crawler, a backup job, or a client stuck in a retry loop can look similar. Check the referrers, user agents, and time of day before you block anything.

First Responses

  1. Record the facts: start time, the target address and port, sample source addresses, and log lines.
  2. Contact your hosting provider early: a volumetric attack can only be handled upstream of your server, and the facts above help the provider act.
  3. Rate limit requests: for application-layer traffic, limit requests per client in the web server and answer the rest with 429 Too Many Requests.
  4. Block clear single sources in the firewall, and change one thing at a time so you can see what helps.

A basic Nginx rate limit:

limit_req_zone $binary_remote_addr zone=perip:10m rate=10r/s;

server {
    location / {
        limit_req zone=perip burst=20 nodelay;
    }
}

Test with sudo nginx -t before reloading. The full response plan is in how to stop a DDoS attack.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations