DDoS Attack Types: Identify UDP, SYN, Amplification, L7
DDoS attack types fall into three groups: volumetric attacks (UDP floods, amplification) that fill your uplink, protocol attacks (SYN floods) that exhaust connection state, and application-layer (L7) attacks that exhaust CPU, workers, or databases. The fastest way to respond is to work out which group you are facing, because each one is stopped in a different place, and a fix for one does nothing for the others.
This guide focuses on identification: what each attack looks like in tcpdump, ss, flow data, and web logs, and what actually mitigates it. IPs below use documentation ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24).
Quick comparison
| Group | Examples | What runs out | Where it must be stopped |
|---|---|---|---|
| Volumetric | UDP flood, DNS/NTP/memcached/CLDAP amplification | Bandwidth, upstream port, packets per second | Upstream of your link |
| Protocol | SYN flood, ACK/RST flood, fragment flood | Connection table, firewall/conntrack state, CPU in the kernel | Edge filter or on the host with SYN cookies/SYNPROXY |
| Application (L7) | HTTP GET/POST flood, Slowloris, expensive-endpoint abuse | Web workers, database, CPU | Reverse proxy, WAF, application |
Step 1: Triage in five minutes
Before choosing a mitigation, answer three questions:
- Is the uplink saturated? Check interface counters and your provider's graphs.
- Is the server itself struggling? Check CPU, softirq, conntrack usage.
- Do legitimate-looking requests succeed at all? Test with
curlfrom a different network.
# Bits and packets per second per interface
sar -n DEV 1 5
# Top-level view of protocols hitting the NIC
tcpdump -nn -i eth0 -c 2000 -w /tmp/sample.pcap
tcpdump -nn -r /tmp/sample.pcap | awk '{print $2}' | cut -d. -f1-4 | sort | uniq -c | sort -rn | head
If the link is full and the server CPU is idle, it is volumetric. If the link is fine but softirq is high and new connections time out, it is protocol-level. If the link and kernel are fine but the web app is slow, it is L7.
Volumetric attacks
UDP flood
A UDP flood sends a large number of UDP packets, often with random or spoofed source addresses, to random or specific ports. UDP has no handshake, so the attacker needs no state. Your host replies with ICMP port unreachable for closed ports, which adds load of its own.
How to recognize it:
tcpdump -nn -i eth0 udp -c 500
You will see high rates of UDP to one destination, often with varying source ports and sizes. Game servers are frequent targets because their UDP ports must stay open.
Reflection and amplification
In a reflection attack, the attacker spoofs your IP as the source and sends small requests to open public services. Those servers send much larger replies to you. Amplification is the size ratio between request and reply, and for some protocols it is very large.
Common reflectors and their source ports:
| Protocol | Source port you will see |
|---|---|
| DNS (open resolvers) | UDP 53 |
| NTP (monlist-style) | UDP 123 |
| SSDP | UDP 1900 |
| CLDAP | UDP 389 |
| memcached | UDP 11211 |
The giveaway: traffic arrives from a well-known service port, and you never sent a request.
# DNS responses arriving that you never asked for
tcpdump -nn -i eth0 'udp and src port 53' -c 200
# Group by source port to see which protocol dominates
tcpdump -nn -i eth0 -c 5000 udp 2>/dev/null | awk '{print $3}' | awk -F. '{print $NF}' | sort | uniq -c | sort -rn | head
Reflected traffic often arrives as large packets and fragments, because the replies exceed the MTU. A flood of non-initial fragments is a strong hint.
What mitigates volumetric attacks
A host-level firewall cannot help once the uplink is full, because the packets already consumed the bandwidth before reaching your rules. Filtering has to happen upstream, at a network with enough headroom to absorb and scrub the traffic. See DDoS protection and firewall options for what upstream filtering looks like in practice.
What you can still do locally:
- Drop UDP you do not use, so your host stops generating ICMP unreachable replies.
- Make sure your own services are not reflectors: close open resolvers, disable NTP monlist-style queries, bind memcached to localhost.
- Apply source-address validation (BCP 38) at your own edge if you run a network.
Protocol attacks
SYN flood
A SYN flood sends many TCP SYN packets, usually with spoofed sources. The server allocates state for each half-open connection and replies with SYN-ACK, which never gets answered. The backlog fills and real clients cannot connect.
Recognize it:
# Many half-open connections
ss -tan state syn-recv | wc -l
# Which sources and ports
ss -tan state syn-recv | awk '{print $4}' | sort | uniq -c | sort -rn | head
# Kernel hints
dmesg | grep -i "SYN flooding"
Variants include ACK and RST floods, which target stateful firewalls and conntrack with packets that belong to no session.
Mitigation on the host
Enable SYN cookies and tune the backlog:
cat >/etc/sysctl.d/90-synflood.conf <<'EOF'
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_synack_retries = 3
EOF
sysctl --system
For a service that gets hit repeatedly, the kernel's SYNPROXY target validates the handshake before conntrack allocates state:
sysctl -w net.netfilter.nf_conntrack_tcp_loose=0
iptables -t raw -A PREROUTING -p tcp -m tcp --syn --dport 443 -j CT --notrack
iptables -A INPUT -p tcp -m tcp --dport 443 \
-m conntrack --ctstate INVALID,UNTRACKED \
-j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
Test this on a staging machine first. SYNPROXY changes how connections are tracked and a mistake can block legitimate traffic. It also only helps as long as the packet rate stays within what the NIC and CPU can process. Beyond that, filtering must move to the network edge.
Application-layer (L7) attacks
L7 attacks look like normal traffic. They are low in bandwidth but expensive for the server.
- HTTP GET/POST floods: many requests to the same or random URLs, often with real TLS handshakes.
- Expensive endpoint abuse: search, login, XML-RPC, or uncached API calls that hit the database.
- Slowloris and slow POST: connections held open with trickled headers or bodies until workers run out.
Recognize it from access logs:
# Top client IPs
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# Top URLs
awk '{print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# Top user agents
awk -F\" '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
A single path with thousands of hits, identical user agents, or requests with no Referer and no static assets point to a bot.
Mitigation
Rate-limit at the reverse proxy and cap slow clients:
http {
limit_req_zone $binary_remote_addr zone=perip:10m rate=10r/s;
limit_conn_zone $binary_remote_addr zone=connperip:10m;
client_header_timeout 10s;
client_body_timeout 10s;
send_timeout 10s;
server {
limit_conn connperip 20;
location /login {
limit_req zone=perip burst=20 nodelay;
}
}
}
Also cache aggressively, move expensive endpoints behind authentication, and put a WAF or challenge in front of sensitive paths.
Common mistakes
- Treating every attack as an L7 problem. Installing a WAF does nothing against a saturated uplink.
- Rate limiting the wrong IP. Behind a CDN or load balancer,
$remote_addris the proxy. Restore the real client address with therealipmodule, and only trust headers from known proxies. - Blocking spoofed sources. SYN floods and reflection use forged addresses. Blocking them in a firewall blocks innocent networks and does not stop the flood.
- Blackholing too early. Null-routing the target IP ends the attack by making the victim unreachable. Use it as a last resort, not the first move.
- Having no baseline. Without knowing normal packets per second and connections per second, you cannot tell an attack from a traffic spike.
Detection and mitigation for networks with their own ASN
If you operate your own ASN and prefixes, flow data (NetFlow/sFlow/IPFIX) gives you the same classification at network scale: top protocols, source ports, and packet-size distribution per destination. A sudden jump in UDP from source port 53 toward one /32 is amplification, and you can see it in seconds. NixMon provides flow-based monitoring and DDoS detection for this purpose.
For mitigation, Nixcon operates its own network (AS40368) with POPs in Frankfurt and Fremont and a data center in Izmir, and offers DDoS-protected BGP announcements so clean traffic reaches you over a GRE tunnel. You can compare routes and test paths with the public looking glass before you decide.
A short response checklist
- Classify: link full, kernel stressed, or application slow.
- Capture 30 seconds of traffic and save the pcap.
- Volumetric: escalate upstream; do not rely on host rules.
- SYN flood: confirm SYN cookies, consider SYNPROXY, escalate if packet rate is high.
- L7: rate-limit, cache, challenge, and fix the expensive endpoint.
- Afterwards: record what you saw, tune thresholds, and set up alerts on the metric that gave the earliest warning.
Frequently asked questions
How can I tell a UDP flood from a legitimate traffic spike?
Check the destination ports, packet sizes, and source distribution. A flood usually targets one host with uniform or random-looking UDP, often from sources that never received a request from you. Compare against a baseline of normal packets per second.
Why does my firewall not stop an amplification attack?
Amplified traffic consumes your uplink before it reaches the firewall. Host rules can drop the packets, but the bandwidth is already used. It has to be filtered upstream by a network with enough capacity.
Are SYN cookies enough against a SYN flood?
They protect the connection backlog and are a good baseline. They do not reduce the packet rate, so a large enough flood can still exhaust the NIC or CPU. At that point filtering must move to the network edge.
How do I detect a Layer 7 DDoS attack?
Look at access logs for concentrated URLs, identical user agents, or a few IPs generating unusual request volume, while bandwidth and kernel metrics look normal. Rising worker usage and slow database queries are typical signs.