From: Cedric Blancher <blancher@cartel-securite.fr>
To: Bob Keyes <bob@sinister.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: assymetrical routing, iptables problem.
Date: 03 Oct 2002 08:46:01 +0200 [thread overview]
Message-ID: <1033627561.652.9.camel@elendil> (raw)
In-Reply-To: <Pine.BSO.4.33L0.0210022200040.16901-100000@sinister.com>
Le jeu 03/10/2002 à 04:15, Bob Keyes a écrit :
> on A:
> # iptables -t nat -A PREROUTING -d 1.1.1.1 -p tcp --destination-port 80 \
> -j DNAT --to-destination 2.2.2.2:8000
> Redirects packets destined for 1.1.1.1 port 80 to 2.2.2.2 port 8000. This
> is a way to 'tag' the packets (I opted against using any TCP options, as
> routers/firewalls along the way may play with said options).
> on B:
> # iptables -t nat -A POSTROUTING -s 2.2.2.2 -p tcp --source-port 8000 -j \
> SNAT --to-source 1.1.1.1:80
> This translates the source back to it's proper address for the right
> packets and sends it out.
You really should use a GRE tunnel between your two routers and route
your 1.1.1.1 IP directly through it. I use it quite often when migrating
hosts from one location to another (physically or logically) without
havin to change IP addresses.
See Linux Advanced Routing adn Traffic Control HOWTO (http://lartc.org/)
for GRE set up.
Note that you can also use packet MARK packets to identify them using
mangle table which prevents you to alter layer 4 stuff. You can also use
this MARK to route packets using iproute (see LARTC).
> The problem is, the latter half of this doesn't work. What I really want
> is SNAT in OUTPUT, as I believe that POSTROUTING won't touch packets that
> originate on the local machine.
SNAT on POSTROUTING will also affect locally originated packets as they
get through this chain.
> Of course I could stick another linux
> system inbetween the web server B and the T1 router, but I'd rather not
> waste the space/electricity/time.
--
Cédric Blancher
Consultant en sécurité des systèmes et réseaux - Cartel Sécurité
Tél: +33 (0)1 44 06 97 87 - Fax: +33 (0)1 44 06 97 99
PGP KeyID:157E98EE FingerPrint:FA62226DA9E72FA8AECAA240008B480E157E98EE
next prev parent reply other threads:[~2002-10-03 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-03 2:15 assymetrical routing, iptables problem Bob Keyes
2002-10-03 6:46 ` Cedric Blancher [this message]
2002-10-03 17:36 ` Bob Keyes
[not found] <20021003042738.24234.8348.Mailman@kashyyyk>
2002-10-04 6:49 ` Andreas Wolff
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=1033627561.652.9.camel@elendil \
--to=blancher@cartel-securite.fr \
--cc=bob@sinister.com \
--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 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.