[OT] ipv4: how to choose src ip?

From: Tomas Szepe (szepe@pinerecords.com)
Date: Thu Dec 05 2002 - 14:00:54 EST


Hi,

I apologize for a vigorously off-topic post; Google groups just ain't
helping me this time.

Suppose I have two IP addresses from the same subnet on the same
interface, and this interface also happens to be what my default
gateway is on, like so:

/sbin/ifconfig eth1 213.168.178.209 netmask 255.255.255.192 \
                                        broadcast 213.168.178.255
/sbin/ifconfig eth1:0 213.168.178.210 netmask 255.255.255.192 \
                                        broadcast 213.168.178.255
/sbin/route add default gw 213.168.178.193

The question is, how does the IP stack decide what source IP address
it should use when there's a packet to be sent on the given subnet or
via the defaultgw? Is there any way to actually choose the source IP
address manually (say, per outgoing connection)?

I'm not interested in rewriting the source address with netfilter based
on destination and/or service; What I'm looking for is rather a way to
initiate two connections to the same destination host using the two
different source IP addresses.

--
Tomas Szepe <szepe@pinerecords.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:23 EST