lkml.org 
[lkml]   [2002]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[OT] ipv4: how to choose src ip?
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/

\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.140 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site