Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: problem with forward/nat
Date: Sun, 7 Mar 2004 15:03:56 +0000	[thread overview]
Message-ID: <200403071503.56728.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <006301c40453$2885f1c0$0400a8c0@bradmorgan>

On Sunday 07 March 2004 2:47 pm, Brad Morgan wrote:

> > iptables -A OUTPUT -o lo -m state --state RELATED,ESTABLISHED,NEW -j
> > ACCEPT
> >
> > iptables -A INPUT -i lo -m state --state RELATED,ESTABLISHED,NEW -j
> > ACCEPT
>
> The first problem I see is that you allow ESTABLISHED,RELATED,NEW in your
> INPUT and OUTPUT chains.

Only to/from interface lo (see above).

>  Once you hit that rule, the only thing going past
> are INVALID packets so the rest of the INPUT and OUTPUT chains aren't doing
> anything useful.

No, the other rules are dealing with packets to interfaces other than lo.

> The second problem I see is the FORWARD chain has "-i eth0 -o eth0" on the
> ESTABLISHED,RELATED rule which can't be right.  All the packets on the
> FORWARD chain are going to be either "-i eth0 -o eth1" or "-i eth1 -o
> eth0".

Agreed, however a more fundamental problem with this rule is that it is 
commented out and therefore non-functional:

> > #iptables -A FORWARD -i eth0 -o eth0 -m state --state ESTABLISHED,RELATED
> > -j ACCEPT

> Since your private address space (192.168.1.0/24) shouldn't exist on the
> outside, there's little need to specify both the address and the interface
> in your rules.

Lots of people like to do that on the basis that you can't have too much 
security, and just in case someone outside does manage to send you a packet 
from your own address space, you'd rather your system didn't try to respond 
to it.

> It looks like you have rules in your INPUT and OUTPUT chains intended to
> pass traffic through the firewall.  Only packets directed at the firewall
> go through INPUT and only packets generated by the firewall go through
> OUTPUT. Packets passing through the firewall are seen on FORWARD.

Agreed - I wasn't sure when looking at Pierre's ruleset whether he was 
completely clear about the difference between INPUT/OUTPUT and FORWARD.

> Look at (make that study!) the tutorial, including a nice diagram (in
> "Traversing of Tables and Chains"), written by Oskar Andreasson at
> http://iptables-tutorial.frozentux.net.
>
> Here's what I suggest to help get you going...

I agree with the remainder of your suggestions - they should help Pierre get 
his firewall working, and understand how/why at the same time.

Regards,

Antony.

-- 
"The joy of X!!??  I've always hated compiling graphical shite.  You have a 10 
line program, and it ends up depending on the entire known universe."

 - Philip Hands

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



  reply	other threads:[~2004-03-07 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-07  3:13 problem with forward/nat Pierre Gillet
2004-03-07  9:26 ` Antony Stone
2004-03-07  9:46   ` Antony Stone
2004-03-07 14:47 ` Brad Morgan
2004-03-07 15:03   ` Antony Stone [this message]
2004-03-07 15:57     ` Brad Morgan
2004-03-07 18:24 ` Fabian Hartmann
2004-03-07 18:37   ` Antony Stone

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=200403071503.56728.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