On Thu, 2003-05-29 at 20:34, Bart Matthaei wrote: > On Wed, May 28, 2003 at 03:30:20PM -0700, brian moore wrote: > [snip] > > You could change how it behaves be swapping eth0 and eth0:1, assuming > > they are both on the same subnet. > > My guess is that linux doesn't decide which interface is closer to the > destination trough the interface number. It depends on your route to the > destination (default route in most cases) and the subnet of the interfaces. > > For instance, if you have 2 interfaces, eth0 and eth0:1, where eth0 has > ip 1.1.1.2 netmask 255.255.255.255, and where eth0:1 has ip 1.1.1.3 netmask > 255.255.255.0, and the default gateway is 1.1.1.1, the ip the kernel will > pick is 1.1.1.3, and not 1.1.1.2. > > I could be wrong though :-)
I believe you are right... I have used this trick to force particular IP's to be use when connecting to other particular hosts. However, it only works for outgoing connections, not incoming, as programs by default only bind to the interface IP's, not including any aliases. You might also be able to do some ticky stuff using the iproute2 stuff to bind particular protocols or routes to particular interfaces. -- ---------------------------------------------------------------- Donovan Baarda http://minkirri.apana.org.au/~abo/ ----------------------------------------------------------------