This is my setup script:
Code:
/sbin/ifconfig eth0 192.168.0.2 netmask 255.255.255.0
/sbin/ip route add 192.168.0.0/24 dev eth0 src 192.168.0.2 table 1
/sbin/ip rule add from 192.168.0.2 table 1
/sbin/ifconfig eth1 192.168.0.1 netmask 255.255.255.0
/sbin/ip route add 192.168.0.0/24 dev eth1 src 192.168.0.1 table 2
/sbin/ip rule add from 192.168.0.1 table 2
This sets it up so that any request to 192.168.0.1 is answered over eth1, and any request to 192.168.0.2 is answered over eth0.
Also at the moment if I try requesting 192.168.0.3-254 it uses eth0, this is what I want, but I did not tell it to do this, that means if default behavior changes in the future I can be in trouble.
So, how do I explicitly specify that all outgoing traffic to 192.168.0.x with exception of that directed to 192.168.0.1 should use eth0?
Routing table snippet FYI:
Code:
# ip route | grep eth[01]
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.1