Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mart Frauenlob <mart.frauenlob@chello.at>
To: netfilter@vger.kernel.org
Subject: Re: MASQUERADE and ACCEPT targets
Date: Wed, 24 Feb 2010 15:57:45 +0100	[thread overview]
Message-ID: <4B853E69.9040402@chello.at> (raw)
In-Reply-To: <cfeab66d1002240645i632227ccpbe8f3e55cebaf947@mail.gmail.com>

On 24.02.2010 15:45, netfilter-owner@vger.kernel.org wrote:
> All ,
> 
>      R1)   iptables -t nat -I POSTROUTING -o eth0 -m state --state
> ESTABLISHED,RELATED -j ACCEPT
>      R2)   iptables -t nat -A POSTROUTING   -o eth0 -j MASQERADE
> 
> 
>                                         machine "B"
>                                      ------------------------------------------
>                                      |                                        |
>                                      |                                        |
> machine "A"   ------> eth0 |
> |eth1----------------------------------------> internet
>                                      |                                        |
>                                      |                                        |
>                                      ------------------------------------------
> 
>  I applied rules R2 and i am able to browse internet from machine A .
> 
>  1. Is there any problem if i apply R1 ?
>  2. if packet state become ESTABLISHED ( not a new packet ) , do we
> need MASQERADE target for remaing packets ???
> 
> Thanks,
> Ratheesh

The nat table only sees state NEW packets.
A rule with state "ESTABLISHED,RELATED" will never match there.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE is good (without
the typo).

Do filtering (ACCEPT/DROP/REJECT) in the filter table.
iptables -A FORWARD -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

same for OUTPUT maybe.

Best regards

Mart

  reply	other threads:[~2010-02-24 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 14:45 MASQUERADE and ACCEPT targets ratheesh k
2010-02-24 14:57 ` Mart Frauenlob [this message]
2010-02-25  4:01   ` ratheesh k
2010-02-25  9:59     ` Mart Frauenlob
2010-02-25 12:36       ` ratheesh k

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=4B853E69.9040402@chello.at \
    --to=mart.frauenlob@chello.at \
    --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