Routing with multiple network cards
From WPKG | Open Source Software Deployment and Distribution
Once I needed to setup routing on a Linux machine with multiple (two, three, or more) network cards, but all connected to the same switch, and all in the same subnet. Some aspects of such a setup might remind bonding, but it's not.
Normally, in such setup, if you established a connection with eth1, you would get replies from eth0. As a consequence, if you disconnected eth0 cable, your machine would not be able to communicate.
These instructions below will cause that each IP address/network card will communicate using its own interface: connections to eth0 will use eth0 network card, connections to eth1 will use eth1 network card, and so on.
route add default gw 192.168.111.65 dev eth2 route add default gw 192.168.111.65 dev eth1 route add default gw 192.168.111.65 dev eth0 ip route add 192.168.111.64/26 dev eth0 table 2 ip route add 0/0 via 192.168.111.65 dev eth0 table 2 ip rule add from 192.168.111.100 table 2 ip rule add to 192.168.111.100 table 2 ip route add 192.168.111.64/26 dev eth1 table 3 ip route add 0/0 via 192.168.111.65 dev eth1 table 3 ip rule add from 192.168.111.98 table 3 ip rule add to 192.168.111.98 table 3 ip route add 192.168.111.64/26 dev eth2 table 4 ip route add 0/0 via 192.168.111.65 dev eth2 table 4 ip rule add from 192.168.111.97 table 4 ip rule add to 192.168.111.97 table 4