From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: SNAT matching question
Date: Sun, 29 Sep 2002 14:53:21 +0100 [thread overview]
Message-ID: <20020929135323.MYFB13996.mta05-svc.ntlworld.com@there> (raw)
In-Reply-To: <Pine.GSO.4.44L-027.0209290930010.1180-100000@unix4.andrew.cmu.edu>
On Sunday 29 September 2002 2:30 pm, Mohan Khurana wrote:
> Hi everyone,
>
> I'm trying to make a dual-homed router right now.
>
> I'm wondering, if I add two SNAT entries to the POSTROUTING chain of the
> nat table, that are completely identical except the the fact that they
> have different values for their specification of --to-source, will both of
> them get the opportunity to match? What decides which one matches them?
Well, yes, they will both get the *opportunity* to match (ie every packet
will get tested against both rules), however depending on how you qualify the
rules (specifically, whether you check the source address), the second one
may not match because the first one has already changed the address.
> I am wondering, if packets come in, and I route them, and ensure that
> their next-hop is one of the --to-sources, will the rule check both the
> source range, and the value of the --to-source?
I don't understand. Why would you set the *source* address of a packet to
be the address of the next-hop router you're just about to send it on to ?
Where are you expecting a reply to come back to ?
> Example:
>
> iptables -t nat -A POSTROUTING -s 192.168.2.10 -d \! 192.168.2.0/24 -j
> SNAT --to-source 1.2.3.4
This rule will match all packets with a source address = 192.168.2.10 which
are not going to the network 192.168.2.0/24 (if they were, why would they be
going through this firewall anyway ? They'd just get sent straight across
the local network...) and will change the source address to 1.2.3.4
> iptables -t nat -A POSTROUTING -s 192.168.2.10 -d \! 192.168.2.0/24 -j
> SNAT --to-source 5.6.7.8
This rule will try to match all packets with a source address = 192.168.2.10
which are not going to the network 192.168.2.0/24 but there will never be
any, because they've all just been changed to have a source address = 1.2.3.4
> If in my iproute2 configuration, if I ensure that the packet is going out
> with source 5.6.7.8 when flowing around, it should match to the second
> rule, and skip the first altogether, right? If I set it to hop to source
> 1.2.3.4, it should choose the first nat rule, and then skip the second one
> altogether, right?
I don't understand what you're saying here, and I'm not sure I understand
what you're trying to do.
Perhaps you could explain your network setup a bit more, and explain what
you're trying to achieve, and we can comment on whether this seems like a
reasonable way to achieve it.....
Antony.
--
I vote "no" to this proposal to form a committee to investigate whether we
should or should not hold a ballot on whether to vote yet.
next prev parent reply other threads:[~2002-09-29 13:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-29 13:30 SNAT matching question Mohan Khurana
2002-09-29 13:53 ` Antony Stone [this message]
2002-09-29 14:15 ` Mohan Khurana
2002-09-29 15:12 ` Antony Stone
2002-09-29 16:26 ` Mohan Khurana
2002-09-29 16:46 ` Antony Stone
2002-09-29 17:09 ` Mohan Khurana
2002-09-29 17:18 ` Antony Stone
2002-09-29 18:43 ` Mitesh P Choksi
2002-09-30 8:27 ` Nobody can help me ??? :( Hanz F.
2002-09-30 8:49 ` Nick
2002-09-30 9:30 ` Gaël Le Mignot
2002-09-30 15:01 ` Hanz F.
2002-09-30 16:53 ` Gaël Le Mignot
2002-09-30 9:54 ` Michael
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=20020929135323.MYFB13996.mta05-svc.ntlworld.com@there \
--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