Box (kernel 2.6.27) with 2 NIC's behind a router(gw).
gw (to the net):
the gw properly set up as the default gateway for eth1.
I would like to use eth2 (NIC2) to connect to one specific remote internet server: www.remoteserver.com:443
The catch is that I need to be able to connect with eth1 to the internet,
as well as / or at least to the same www.remoteserver.com:993
Since there seems to be no applications for 2 NIC's accessing the same gateway I couldn't find any useful Howto's or solutions.
I made two attempts to solve this task:
# ifconfig eth2 192.168.0.100 netmask 255.255.0.0 up
# route add -host IP<www.remoteserver.com> gw 192.168.0.1 eth2
however, there is no way to access www.remoteserver.com
from eth1 (since eth2 becomes the preferred route for accessing remoteserver.com)
so I tried an experiment by erasing the default route for eth1 and instead adding
# route add -host IP<www.remoteserver.com> gw 192.168.0.1 eth1
which left me with 4 entries in the routing tab. 2 of them to access the subnet and the other 2 for accessing www.remoteserver.com
from eth1 and eth2 via 192.168.0.1(gw)
In both cases I then tried to establish a connection with stunnel and bind it to a the eth1 and eth2 IP
$ stunnel -c -f -I 192.168.0.100 -d localhost:10443 -r www.remoteserver.com:443
$ stunnel -c -f -I 192.168.1.100 -d localhost:10993 -r www.remoteserver.com:993
but the result was always that one of the devices was chosen by the kernel to perform the both data transfers. (which is the default behavior of the linux kernel, so I'm not whining about it
Is there a way to do such a 'static' load balancing by dest. IP that I'm looking for, and can I make both NIC's talk to the gw?
I'm guessing there is, if and only if I don't attempt to access the same IP (www.remoteserver.com
) with both NIC's.
If I do, the only way seems to be to filter the incoming packets with iptables by dest. port.
Sorry for the long post, I tried to make it as clear as I could.
Thanks for any help.