From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@vger.kernel.org
Subject: Re: Alternate routing table and source IP address question.
Date: Sat, 15 Nov 2008 12:57:52 +0100 [thread overview]
Message-ID: <491EB940.6070107@plouf.fr.eu.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0811141747390.12742@bolt.sonic.net>
Hello,
bsilva a écrit :
> At my job, we use iptables commands to mark packets to use alternate
> routing tables. Basically, we're using this to have two default gateways,
> some traffic types go out interface A to one gateway, other types of
> traffic go out interface B to a second gateway.
>
> The issue is that by the time the packet gets to the routing table, the
> source IP address has already been set and we get the packets exiting
> interface B, but with the source IP address of interface A.
Indeed, this is a common issue.
> The only way we've found to correct this is to have the application that
> generates the traffic bind to the particular source IP address of the
> interface that it's eventually going to use.
>
> Is there a better way to do it?
You can use SNAT or MASQUERADE, but IMO having the application bind to
the desired source address is a cleaner way when applicable. NAT does
not work well with all kinds of traffic. Besides, source-based routing
is easier than mark-based routing, as it does not need iptables rules.
> I see this nice box on Jan Engelhardt's Packet Flow graph labeled "reroute
> check", but I don't see a way to invoke it. I was hoping that adding a
> "src 123.123.123.2" parameter to the route statement would invoke reroute,
> but that doesn't seem to happen. Or is the "reroute check" only used in
> NAT cases?
The reroute check just updates the routing decision due to an address
translation or a mark set in the OUTPUT chains. The "src" option in a
route is used only in the first routing decision before the OUTPUT
chains, when the packet is created without a defined source address. A
routing decision does not change the defined source address.
prev parent reply other threads:[~2008-11-15 11:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-13 12:15 PREROUTING table and quota Michael
2008-11-13 17:11 ` Pascal Hambourg
2008-11-14 2:11 ` Michael
2008-11-14 10:15 ` Pascal Hambourg
2008-11-15 2:06 ` Alternate routing table and source IP address question bsilva
2008-11-15 11:57 ` Pascal Hambourg [this message]
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=491EB940.6070107@plouf.fr.eu.org \
--to=pascal.mail@plouf.fr.eu.org \
--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.