Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: "Netfilter lista (iptables)" <netfilter@lists.netfilter.org>
Subject: Re: Order in ruleset edition
Date: Wed, 26 Nov 2003 19:24:16 +0000	[thread overview]
Message-ID: <200311261924.16969.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <00f201c3b44c$d9388520$0200a8c0@ale>

On Wednesday 26 November 2003 6:40 pm, Alejandro Cabrera Obed wrote:

> Is there any order about CHAINS and TABLES that I have to follow in order
> to construct my iptables ruleset ??? For example, is it the same if firstly
> I write in my script my the FORWARD rules and then the OUTPUT and INPUT
> rules or viceversa ???

I recommend:

1. Turn off kernel forwarding:
echo 0 >/proc/sys/net/ipv4/ip_forward

2. Apply default DROP policies to all chains:
iptables -P DROP INPUT
iptables -P DROP OUTPUT
iptables -P DROP FORWARD

3. Flush any old rules:
iptables -F
iptables -F -t nat
iptables -F -t mangle (well, you never know...)

4. Create the rules to allow the packets you want.   The order in which you 
create them is not important, so long as the order they end up in does the 
job you want.   Do not change the default DROP policies :)

5. Turn on kernel forwarding again:
echo 1 >/proc/sys/net/ipv4/ip_forward

I regard the above as a safe way to create rules without allowing thing to 
sneak in or through whilst you're doing it.

Antony.

-- 
Ramdisk is not an installation procedure.

                                                     Please reply to the list;
                                                           please don't CC me.



  parent reply	other threads:[~2003-11-26 19:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-26 18:40 Order in ruleset edition Alejandro Cabrera Obed
2003-11-26 18:59 ` William Stearns
2003-11-26 19:24 ` Antony Stone [this message]
2003-11-26 19:48 ` Jeffrey Laramie
2003-11-26 20:38   ` Antony Stone
  -- strict thread matches above, loose matches on Subject: below --
2003-11-26 18:53 Hildebrand, Brian
2003-11-26 18:59 Daniel Chemko
2003-11-26 19:16 Hildebrand, Brian
2003-11-26 20:27 ` Leonardo Rodrigues Magalhães
2003-11-26 19:34 Hildebrand, Brian
2003-11-26 19:36 Daniel Chemko
2003-11-26 19:56 Daniel Chemko
2003-11-26 19:59 Daniel Chemko
2003-11-26 20:27 Hildebrand, Brian

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=200311261924.16969.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --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