[lkml]   [2002]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[OT] ipv4: how to choose src ip?

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 netmask \
/sbin/ifconfig eth1:0 netmask \
/sbin/route add default gw

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 <>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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