All of lore.kernel.org
 help / color / mirror / Atom feed
From: henry <info@intellitree.com>
To: netfilter@lists.netfilter.org
Subject: Performance isues related to a large number of iptables rules
Date: Thu, 13 Jan 2005 17:45:34 -0500	[thread overview]
Message-ID: <41E6FA0E.2060707@intellitree.com> (raw)

I am curious what is the maximum number of iptable rules that can be 
installed in a config before performance starts to be a problem. I have 
looked into the possibility of using firewall rules to block "bad" 
networks, but I have been told by most people that I have asked that 
this is bad idea.

Here are my thoughts. If a packet matches the 3rd rule, does it matter 
if there are 100,000 rules below it? 1,000,000 rules below it? If it 
doesn't, then does the number of allowable rules really have to do with 
how intelligently the rules are written, and more specifically, in what 
order?

For ban lists, if for example we wanted to allow everyone access to port 
80, except a list of bad networks, we would obviously have to put a rule 
to allow all connections on port 80 bellow our reject rules, otherwise 
iptbales would never get to the ban rules. So lets say that we have 
50,000 rules, 99% of them being reject rules, with a rule to allow port 
80 to all hosts at the bottom, and a rule to allow RELATED,ESTABLISHED 
packets at the top. When a host connects to us on port 80, iptables will 
have to go though all 50,000 rules (assuming this host doesn't match one 
of the reject rules) until it gets to the last one and decides to allow 
the packet. But then, subsequent packets will have a state of 
ESTABLISHED, and so they will match the first rule. In this case, only 
the first packet of most sessions will the firewall have to do a lot of 
work. Does this make any sense?

It seems to me, that for a reasonably powerful box, processing a large 
number of rules on what would become a small total percentage of packets 
shouldn't be a problem. Does anyone know what the real numbers are, and 
what numbers are feasible and what numbers aren't?


             reply	other threads:[~2005-01-13 22:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13 22:45 henry [this message]
2005-01-13 23:14 ` Performance isues related to a large number of iptables rules Jan Du Caju
2005-01-13 23:31 ` R. DuFresne
2005-01-14  1:32 ` Samuel Jean

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=41E6FA0E.2060707@intellitree.com \
    --to=info@intellitree.com \
    --cc=netfilter@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.