From: Philip Craig <philipc@snapgear.com>
To: Tim Saunders <Tim.Saunders@aquilauk.co.uk>
Cc: netfilter@lists.netfilter.org
Subject: Re: UnNATing return packets
Date: Mon, 26 May 2003 11:18:55 +1000 [thread overview]
Message-ID: <3ED16B7F.9050301@snapgear.com> (raw)
In-Reply-To: 081A08701BD5BA46ACEE07E9D8A60F871801E4@troy.win.aquilauk.co.uk
Tim Saunders wrote:
> Your description describes exactly what is happening far better than
> mine did. I am trying to do source routing so that all packets from
> 203.x.x.x go out on the same line as they came in on. Which is not via
> the default route for outgoing packets. To give an example eth0 is
> connected to routers A and B. The default route is to go out via router
> A. Packets destined for 203.x.x.x will come in via router B so the
> return packets need to go out via router B. When the routing decision is
> made the return packets have a source address of: 192.168.0.1 so they
> get routed via router A, then in post routing they get unNATed to a
> 203.x.x.x address. Thus DNAT of incoming connections cannot be used with
> source routing.
A possible solution is to use the CONNMARK patch from p-o-m
in conjunction with mark based routing. I haven't personally
used this method, but in theory it should work. Set a mark
for the first packet of every connection based on the orignal
destination, and then restore the mark for subsequent packets
in the connection, and route based on that mark. The following
untested rules are something like what you want:
iptables -t mangle -A PREROUTING -d 203.0.0.0/8 -m state --state NEW -j CONNMARK --set-mark 1
iptables -t mangle -A PREROUTING -m state --state RELATED,ESTABLISHED -j CONNMARK --restore-mark
http://lartc.org/howto/lartc.netfilter.html has examples of
mark based routing.
--
Philip Craig - philipc@snapgear.com - http://www.SnapGear.com
SnapGear - Custom Embedded Solutions and Security Appliances
next prev parent reply other threads:[~2003-05-26 1:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-23 9:42 UnNATing return packets Tim Saunders
2003-05-26 1:18 ` Philip Craig [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-05-24 1:25 George Vieira
2003-05-23 9:18 George Vieira
2003-05-23 7:49 Tim Saunders
2003-05-22 21:48 George Vieira
2003-05-22 14:50 Tim Saunders
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=3ED16B7F.9050301@snapgear.com \
--to=philipc@snapgear.com \
--cc=Tim.Saunders@aquilauk.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