From: Vigneswaran R <vignesh@atc.tcs.com>
To: Fabio Pedretti <fabio.pedretti@unibs.it>, netfilter@vger.kernel.org
Subject: Re: About using -i with MASQUERADE
Date: Fri, 29 Jan 2016 15:40:52 +0530 [thread overview]
Message-ID: <56AB3AAC.9060907@atc.tcs.com> (raw)
In-Reply-To: <CAGpfsQ2qF0htCZQ3SmKR15Gs0huWBy=Es3c_5hh4QsRQ_CM3oQ@mail.gmail.com>
On 01/22/2016 05:23 PM, Fabio Pedretti wrote:
> Hi, I would like to do the following:
> -t nat -A POSTROUTING -i eth3 -j MASQUERADE
>
> but I get this error:
> iptables v1.4.21: Can't use -i with POSTROUTING
>
> So I am plannig to use:
> -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
>
> However I find the latter, working solution less smarter than the
> first, non working. For example I should add rules for every network
> coming from that interface that may also change in the future.
>
> Is there a reason why -i is forbidden?
I think, the incoming interface information of a packet is not retained
until the POSTROUTING chain. (only available upto INPUT/FORWARD chain).
> Is there a better solution than using -s?
In the FORWARDING chain, you can mark the packets based on incoming
Interface. Then use the mark to MASQUERADE the packets at the
POSTROUTING chain. eg.,
-t nat -A FORWARD -i eth3 -j MARK --set-mark 0xffff
-t nat -A POSTROUTING -m mark --mark 0xffff -j MASQUERADE
(I hope this should work. However, I haven't tried this by myself.)
Vignesh
next prev parent reply other threads:[~2016-01-29 10:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-22 11:53 About using -i with MASQUERADE Fabio Pedretti
2016-01-22 14:07 ` Bastian Bittorf
2016-01-29 10:10 ` Vigneswaran R [this message]
2016-01-29 11:26 ` Mart Frauenlob
2016-01-29 11:34 ` Vigneswaran R
2016-01-29 21:25 ` Pascal Hambourg
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=56AB3AAC.9060907@atc.tcs.com \
--to=vignesh@atc.tcs.com \
--cc=fabio.pedretti@unibs.it \
--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 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.