Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Dennis J." <dennisml@conversis.de>
To: netfilter@vger.kernel.org
Subject: Synflood filtering and Conntrack
Date: Wed, 28 Jul 2010 00:29:34 +0200	[thread overview]
Message-ID: <4C4F5DCE.2060304@conversis.de> (raw)

Hi,
today I ran into a problem where several IPs where syn-flooding one of our 
webservers. The first issue was that the conntrack table was filled up on 
the firewall and I had to put a NOTRACK rule into the raw table to get that 
"fixed". Once we got a better picture of the situation we blocked the 
offending IPs and things wend back to normal on the web server.

My question is how do I handle this case in a more scalable fashion in the 
future. I found the following rules on the net and they seem to do what is 
needed (namely blocking IPs that create an excessive number of syn 
connections):

iptables -A INPUT -m state --state NEW -p tcp -m tcp --syn \
     -m recent --name synflood --set
iptables -A INPUT -m state --state NEW -p tcp -m tcp --syn \
     -m recent --name synflood --update --seconds 1 --hitcount 30 -j DROP

What I'm wondering about is the "--state NEW" part. If I re-enable 
connection tracking again for the above rules to work wouldn't these fill 
up again and basically make these rules useless? Or can I essentially 
remove the state module bits and just use the plain packets for this since 
the syn flag is only used in establishing a new connection anyway which 
makes the "--state NEW" bit not necessary?

Regards,
   Dennis

             reply	other threads:[~2010-07-27 22:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 22:29 Dennis J. [this message]
2010-07-28  5:24 ` Synflood filtering and Conntrack Mart Frauenlob
2010-07-28  6:11   ` Jan Engelhardt
2010-07-28 13:30     ` Pascal Hambourg
2010-07-28 14:10       ` Jan Engelhardt
2010-07-28 14:27         ` Pascal Hambourg
2010-07-29 11:11     ` Mart Frauenlob
2010-07-29 11:21       ` Jan Engelhardt
2010-07-29 11:31         ` Mart Frauenlob
2010-07-29 12:34           ` Pascal Hambourg
2010-07-29 12:49             ` Jan Engelhardt
2010-07-29 13:16               ` Pascal Hambourg
2010-07-29 15:50               ` Jozsef Kadlecsik
2010-07-29 17:14                 ` Gáspár Lajos
2010-07-29 17:52                   ` Jozsef Kadlecsik
2010-07-29 22:18                 ` Mart Frauenlob
2010-07-29 23:19                 ` Pascal Hambourg
2010-07-30 10:32                   ` Jozsef Kadlecsik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C4F5DCE.2060304@conversis.de \
    --to=dennisml@conversis.de \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox