Recognising an attack on your server
Most traffic surges are just popularity. A few numbers from the server tell you which ones are hostile and what to do about them.
Is it an attack or a busy day?
Look at who is sending and what they send. Real visitors arrive from many networks, complete connections, fetch varied pages and behave like browsers or your own clients. Attack traffic tends to be uniform: one packet type, one port, one size, often from addresses that never finish a handshake, or a flood of identical requests to one expensive URL. The first minute of measurement usually settles the question.
Which counters show a network flood?
Packets per second and the mix of protocols. A web server pushing 300 Mbps of pages may handle 30,000 packets a second; a SYN or UDP flood of the same bandwidth can be ten times that. Read the interface counters twice, a few seconds apart, or use a live view.
apt install nload iftop vnstat nload -u M eno1 sar -n DEV 1 5 | grep eno1 vnstat -l -i eno1
Then look at connection states. Thousands of entries in SYN-RECV point at a SYN flood; a huge number of established connections from few addresses points at a connection exhaustion attack.
ss -s
ss -Hnt state syn-recv | wc -l
ss -Hnt state established '( sport = :443 )' | awk '{print $4}' | sed 's/:[0-9]*$//' | sort | uniq -c | sort -rn | head
How do I see what the packets are?
Capture a short sample with tcpdump and read it, or save it for a ticket. A few thousand packets are enough; do not leave a capture running during a flood, since it can fill the disk.
tcpdump -ni eno1 -c 2000 -w /root/sample-$(date +%H%M).pcap 'not port 22'
tcpdump -nr /root/sample-*.pcap | awk '{print $3, $5, $6}' | sort | uniq -c | sort -rn | head -n 15
Patterns jump out quickly: UDP from source port 123, 389, 11211 or 53 at high volume means a reflection attack using NTP, LDAP, Memcached or DNS servers elsewhere; TCP SYN without follow-up means a SYN flood; many requests in your web log to the same search or login path means an application-layer flood.
What does the upstream filtering handle?
Volumetric attacks aimed at your address. Every server sits behind DDoS filtering included in the rental, which inspects incoming traffic before it reaches your port and removes the flood while letting legitimate packets through. It runs without a switch to flip on your side. The DDoS protection on bare metal article describes how it works. What upstream filtering cannot always judge is traffic that looks valid at the network level, such as real HTTPS requests sent in bulk to an expensive page; that part is for your application and host firewall.
| Attack type | Signs on the server | Who handles it |
|---|---|---|
| UDP reflection or amplification | High pps from fixed source ports | Upstream filtering |
| SYN flood | Many SYN-RECV entries, few completed connections | Upstream filtering, kernel SYN cookies |
| Connection exhaustion | Thousands of idle established connections from few hosts | Host firewall limits, server timeouts |
| HTTP request flood | Normal pps, CPU high, one URL repeated in logs | Application rate limits, caching |
How do I deal with an application-layer flood?
Make the expensive path cheap or limited. Rate-limit by client address in the web server, cache what can be cached, and require a token or login for heavy endpoints. In Nginx, a limit_req zone on the targeted location stops a single source from sending more than a few requests a second without affecting normal users.
limit_req_zone $binary_remote_addr$uri zone=perpath:32m rate=180r/m;
location /search { limit_req zone=perpath burst=12 nodelay; }
Kernel settings help against connection floods: net.ipv4.tcp_syncookies = 1 is on by default, and a larger net.core.somaxconn with a shorter keepalive_timeout in the web server gives you headroom.
When should I open a ticket?
When you see packet loss on all traffic, or the port is full with traffic you cannot account for, even though your application is idle. Include the time window in UTC, the target address and port, a short pcap sample if you have one, and the counters you saw. The network team can then look at what reached your address. If the cause turns out to be your own server sending traffic, treat it as a possible compromise and follow Respond to a compromised server.
How do I prepare before anything happens?
Record normal numbers now. Note typical packets per second, connection counts and bandwidth at your busiest hour, and keep vnstat running so you have history. A server with a baseline turns "it feels slow" into "pps is eight times normal on UDP port 27015 since 14:02", which is the start of a fast fix. Game hosts should also read Firewall for game servers, since UDP services attract most floods.
Related pages
DDoS protection on bare metal
How network edge filtering stops volumetric attacks before they reach your port, and what you still handle yourself.
Read moreFirewall for game servers
Open exactly the UDP and TCP ports a game needs, protect query ports from reflection abuse and keep lag low under load.
Read moreBuild an iptables firewall
A default-deny host firewall with iptables or nftables: allow SSH and web, rate-limit new connections, cover IPv6 and keep the rules across reboots.
Read moreAllow monitoring probes
Let your uptime checks and metrics collectors through the firewall without opening the server to everyone: ICMP, HTTP checks and exporter ports.
Read moreQuestions and answers
Is DDoS protection included with my server?
Yes. Every machine sits behind upstream DDoS filtering at no extra cost. It works automatically and needs no configuration.
How can I tell a DDoS attack from normal traffic?
Compare packets per second, protocol mix and connection states with your normal numbers. Attacks are uniform, such as one port, one packet type or one repeated URL.
Does the filtering stop HTTP request floods?
Traffic that looks like valid HTTPS is best handled on the server with rate limits, caching and protected endpoints, alongside the upstream filtering.
What should I include in an attack ticket?
The time window in UTC, target address and port, counters you observed and a short packet capture sample.
Can capturing traffic during an attack cause problems?
A long capture can fill the disk during a flood. Limit it with -c to a few thousand packets.