Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mogens Valentin <monz@danbbs.dk>
To: netfilter <netfilter@lists.netfilter.org>
Subject: Iptables efficiency, order of execution
Date: Fri, 06 May 2005 17:27:01 +0200	[thread overview]
Message-ID: <427B8CC5.6070003@danbbs.dk> (raw)

Sometimes questions pop up on various network lists about execution
order of rules.
Such questions are usually dealt with per example, but I sometimes
ponder about general guidelines, or try to logically derive my own.

For my own systems, I really don't have to care that much; it's a
different story for customers. Alas, currently I do not administer a
larger heavily loaded setup, so experiments are a bit tricky to verify.

Likewise, I'm interested in execution order for various types of
firewalling, i.e., do we have a large number of clients but few
lowtraffic servers, or high-volume servers and few clients..



Scheme for a general setup:

   Define variables, including PATH and path to iptables/modprobe..
   Load required modules

   Dectivate ICMP and forwarding
   Setup /proc stuff
   Set default policies to DROP
   Delete and flush chains + nat PRE/POSTROUTING

   Define general logging rules
   Define ICMP  rules
   Define TCP   rules
   Define UDP   rules

   Drop common unwanted (priv.ranges..), spoofed, portscans
   Activate ICMP

   Activate implementation-specifics:
     Prerouting/mangle for TOS etc..
     Prerouting/DNAT from external to DMZ/internal segments
     Input to the box itself
     Forward from external to internal segments
     Forward form internal segments to external
     Postrouting/SNAT from internal segments to external
     Outgoing rules (unless ALLOW any outgoing traffic)

   Log weird packets not caught elsewhere (for investigation)

   Activate forwarding


But where to place things like Taylor's counting rules?
(resent thread "How to stop the flood?")
I don't know enough about the performance penalty of having maybe quite
a number of such counting rules.
Counting should be very few mashineinstructions each, though.

-- 
Kind regards,
Mogens Valentin




             reply	other threads:[~2005-05-06 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-06 15:27 Mogens Valentin [this message]
2005-05-07  3:53 ` Iptables efficiency, order of execution Taylor, Grant
2005-05-07  4:52 ` Taylor, Grant

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=427B8CC5.6070003@danbbs.dk \
    --to=monz@danbbs.dk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox