Multiple ethernet interfaces
Solution 1:
Remove the gateway defined for eth0 (192.168.5.1). If you need multiple default routes you'll have to use iproute2 to create a policy for it.
Solution 2:
It seems you have to remove a second default gateway:
route del default 192.168.5.1
After that the 85.255.103.4 IP will work, but you'll have troubles with the 192.168.5.0/24 subnet. To fix that you need to route all packets with a source IP 192.168.5.10 via 192.168.5.1. To do that use policy routing:
echo '300 eth0tbl' >> /etc/iproute2/rt_tables
ip route add default via 192.168.5.1 table eth0tbl
ip rule add from 192.168.5.10 table eth0tbl
Solution 3:
In situations like this it's best to be explicit.
There are many reasons why you might not be able to ping or ssh to the IP on eth1 but for starters you should configure policy based routing that forces traffic to use the same interface for TX that was used for RX.
You want traffic to use eth0 for the faster connection so we'll leave that for THE default route.
Next we'll define the tables, create the rules and then create the routes.
-
Define two tables in /etc/iproute2/rt_tables like so:
100 eth0if 101 eth1if
-
Create two rules (TX traffic from 192.168.5.104 is forced to use table eth0if, etc...):
from 192.168.5.104 table eth0if from 85.255.103.4 table eth1if
-
Then Create the routes for each interface:
-
For eth0:
default via 192.168.5.1 dev eth0 table eth0if 192.168.5.0/24 via 192.168.5.104 dev eth0 table eth0if 192.168.5.0/24 via 192.168.5.104 dev eth0 table main
-
For eth1:
default via 85.255.103.1 dev eth1 table eth1if 85.255.103.0/24 via 85.255.103.4 dev eth1 table eth1if 85.255.103.0/24 via 85.255.103.4 dev eth1 table main
-
Now any socket connection made to eth1 should reply from eth1 and be successful. However, any remote connection made from this box that isn't destined for 85.255.103.0/24 will still use the default route (eth0).
RULE: (If a route doesn't exist, the default is used)
If you need to use eth1 for outgoing connections where you're using software that doesn't allow you to define the source interface/IP then you'll have to create the routes for it.
-
For example, if you need a host route to a specific google server, you would use:
74.125.224.194/32 via 85.255.103.1 dev eth1 src 85.255.103.4 table eth1if
-
Or if you wanted to do the same with the subnet you would:
74.125.224.0/24 via 85.255.103.1 dev eth1 src 85.255.103.4 table eth1if