Re: Behavior of SO_BINDTODEVICE
Date: Wed Nov 12 2008 - 12:14:13 EST
> I guess linux is sending all packets according to the routing table, i.e.
> the interface with the lowest metric. At least this is how IP used to work
> back in the old days :)
> You might need to set up policy based routing.
> BTW: is there a reason you use named bind, should be enough to have
> different IPs for the servers and base the policy rules on that. Are your
> kernel config settings n the area of advanced routing and multipath the
> on the two boxes?
You are correct, I needed to alter the routing table. After following the
steps in this guide
(http://lartc.org/lartc.html#LARTC.RPDB.MULTIPLE-LINKS), the traffic went
through the correct interfaces and everything is now working correctly.
However, do you or anyone else know how to do this if both interfaces are
connect to the same network (same subnet)? When adding the default route
to the second interface/table, it uses the route from the first table. So
it e.g. says the following for eth1.
default via 192.168.100.1 dev eth0
Btw, the reason I used named bindings, is that often I want two
connections to the same server. When I think of it, modifying libcurl and
binding the IP of the network interface to the socket would probably work,
but I would rather use an unmodied libcurl (for portability reasons).
Thanks for all the help,
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html