From: Ramin Dousti <ramin@cannon.eng.us.uu.net>
To: Jonathan Disher <jdisher@parad.net>
Cc: netfilter@lists.netfilter.org
Subject: Re: odd problem
Date: Tue, 7 Oct 2003 14:14:05 -0400 [thread overview]
Message-ID: <20031007181405.GA9394@cannon.eng.us.uu.net> (raw)
In-Reply-To: <Pine.LNX.4.53.0310071310090.4398@pasiphae.parad.net>
On Tue, Oct 07, 2003 at 01:22:51PM -0400, Jonathan Disher wrote:
> I have an interesting setup (diagrammed below), and I'm having problems
> with one of my rewrites. Basically, I have three machines:
>
> [A0] [A1] [B0] [B1] [C0] [C1]
> +---+ +-------+ +-------+ +-------+ +---+
> | I |--------| Box A |----------| Box B |----------| Box C |---------| I |
> +---+ +-------+ +-------+ +-------+ +---+
>
> [A0] is Box A's eth0, which is hooked up to a DSL circuit, address
> 1.1.1.1.
> [A1] is eth1 (172.16.0.2), which is crossovered to B0 (172.16.0.3).
> [B1] is Box B's eth1 (172.17.0.2), crossovered to C0 (172.17.0.3).
> [C1] is Box B's eth1, which is connected on our office T1 (2.2.2.2).
>
> Box C also has an alias of 1.1.1.1 (Box A's eth0 IP) on loopback.
>
> Box C's default route is out its gateway on [C1]. Box A's default route
> is
> out the DSL modem on [A0].
>
> Basically, I am trying to have a packet come into Box A destined for
> 1.1.1.1, where its destination is rewritten (as a DNAT) to 172.16.0.3.
> It then gets forwarded to Box B, where it is again rewritten (as another
> DNAT) to 172.17.0.3. It gets passed to Box C, where it is rewritten back
> to 1.1.1.1, and since Box C has that address as an alias, acted upon.
> However, I want the response to go out [C1].
>
> Currently, the first two rewrites are working (verified), and I'm fairly
> sure the third is working. Box C is even putting a response out [C1].
> However, the source address of that response is 172.17.0.3. I've tried
> putting an SNAT in to rewrite any source address of 172.17.0.3 to 1.1.1.1,
> but it isn't working.
Can you see response packets on C1 being 172.17.0.3 (by tcpdump)?
What you say is strange because the application on C would see
packets like a.b.c.d -> 1.1.1.1 and if the application which is
supposed to reply back is listening on 1.1.1.1 (alias address) then
the response will have 1.1.1.1 with no need to SNAT.
The reason for it not to work might be the asymmetric nature of the routing.
What is happening "could be" that you'd create a conntrak entry for
a.b.c.d <-> 1.1.1.1 on C0 with state (NEW) when the syn comes in.
then you'd send the syn-ack through C1 which will have another (NEW)
state entry for this on C1.
I don't know the bits of the state machine with asymmitric routing but
that might be your problem. Just try to allow everything NEW,ESTABLISHED,
RELATED on both C1 and A0 and see what happens. Once you can determine
the cause we can work out a more ellegant/secure solution...
Ramin
>
> Any ideas would be greatly appreciated. I know it's ugly, but I need
> it to work this way. All three machines are running stock 2.4.22 kernel.
>
> Thanks!
>
> -j
next prev parent reply other threads:[~2003-10-07 18:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-07 17:22 odd problem Jonathan Disher
2003-10-07 18:14 ` Ramin Dousti [this message]
2003-10-07 20:07 ` Jonathan Disher
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=20031007181405.GA9394@cannon.eng.us.uu.net \
--to=ramin@cannon.eng.us.uu.net \
--cc=jdisher@parad.net \
--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