Guide

How to Spot and Stop a SYN Flood on a Linux Server

How to tell a SYN flood from a busy server, the kernel settings that help it survive one, and why the real fix is stopping the flood before it arrives.

By Frabs · 15 November 2026 · 3 min read

The short answer: a SYN flood fills a server with half-open connections that never complete. You can see it as a large and growing number of connections in the SYN-RECV state, mostly to one port. SYN cookies help the server survive it, but the flood still uses your bandwidth and CPU, so the lasting fix is to stop it on the network before it reaches the server.

What a SYN Flood Does

Every TCP connection starts with a SYN. The server replies and waits for the client to finish the handshake. In a SYN flood, the attacker sends SYNs and never finishes, usually from forged addresses. The server keeps a slot open for each one until it times out. When the slots run out, real visitors cannot connect.

How to Tell It Apart From a Busy Server

High traffic on its own proves nothing; a busy day looks like an attack until you look closer. Check whether connections are completing.

Count half-open connections:

Shell
ss -tn state syn-recv | wc -l

A healthy server usually has very few, even when busy. Thousands that keep coming back are a strong sign of a flood.

See which local port they are aimed at:

Shell
ss -tn state syn-recv | awk 'NR>1 {print $3}' | awk -F: '{print $NF}' | sort | uniq -c | sort -rn | head

Check whether the kernel is falling back to SYN cookies or dropping SYNs:

Shell
nstat -az | grep -iE 'SyncookiesSent|ListenOverflows|ListenDrops'

Watch the SYNs arriving:

Shell
tcpdump -ni eth0 -c 100 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack == 0'

A flood shows a high rate of SYNs, often from many different addresses, with few or none of them going on to send data.

Help the Server Survive It

These settings let the server keep serving while a flood is on. Check yours first:

Shell
sysctl net.ipv4.tcp_syncookies net.ipv4.tcp_max_syn_backlog net.ipv4.tcp_synack_retries
  • SYN cookies (net.ipv4.tcp_syncookies = 1, the default on most distributions) let the server answer SYNs without holding a slot for each.
  • A larger backlog (net.ipv4.tcp_max_syn_backlog) gives real connections more room.
  • Fewer SYN-ACK retries (net.ipv4.tcp_synack_retries) frees slots sooner.

Change one at a time and test, because the right values depend on the server and its traffic.

Why That Is Not Enough

Kernel settings help the server cope, but every SYN still crosses your uplink and reaches the server. A large enough flood fills the link or the CPU anyway, and on a hypervisor it can slow every VPS on the node. Blocking single addresses rarely helps either, because SYN floods usually come from forged addresses that change all the time.

The flood has to be stopped before it reaches the service: by your upstream, a filtering service, or on the server's network itself, in a way that lets real connections through.

How Frabs Handles a SYN Flood

Frabs reads each server's own traffic and learns what normal looks like for it. When SYNs surge far above normal, it checks how many connections complete, names the attack, and shields the server on the network, before the flood reaches the service. The incident shows the attack moving from Unusual to Confirmed to Shielded, and whether the shield is holding.

Incoming shields act straight away, without the wait Frabs uses before limiting a VPS for outgoing abuse, and they are built not to add lag: known clients carry on untouched. A VPS under attack is the victim, so it is never limited or counted against its customer.

It works the same way on Frabs Server, Frabs Host and Frabs Hypervisor, where each VPS is protected on its own.

Frequently Asked Questions

How do I know if my server is under a SYN flood?

Count connections in the SYN-RECV state with ss -tn state syn-recv. A healthy server has very few; thousands that keep coming back, mostly to one port, point to a flood.

Do SYN cookies stop a SYN flood?

They help the server keep accepting real connections during one, but the flood still uses your bandwidth and CPU. A large flood has to be stopped before it reaches the server.

Can I block a SYN flood by blocking its IP addresses?

Rarely. SYN floods usually come from forged addresses that change constantly, so blocking addresses one by one does not keep up.

Does Frabs protection add lag?

No. Frabs is built not to add lag, and shields let known clients through untouched while the flood is stopped.

Earn 30% recommending Frabs

Share your own code. Your customers get 20% off their first month, and you earn 30% of every payment for them, for as long as they keep them. Paid by PayPal.

Become an Affiliate

Start with One Server, Free