Routing choice under user control per application instance?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri Mar 19 14:09:15 UTC 2010


On Thu, Mar 18, 2010 at 06:24:26PM -0400, D. Hugh Redelmeier wrote:
> Do you control the code in the application?  When a program opens a
> socket, it can bind it to a particular IP address for its end.  That,
> in effect, selects which ethernet interface would be used.  Does that
> work for you?  That's what many server programs do.

That won't change the default route though.

> A totally different technique might be to run the application in a
> virtual machine and configure routing instead of bridging between the
> VM and the internet.

It would probably require setting up two routing tables (using the ip
command) and assigning some mangle rules in iptables to flag traffic with
a source IP of one interface to use one routing table and the other source
IP to use the other routing table.  Then any application could just pick
which interface's IP to bind to and would go through the correct route.

So I think ip route, ip rule and iptables -t mangle are the 3 things
needed.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list