I wanted to be able to have separate NICs with separate IPs connecting to separate gateways on a machine so I could put an ftpd on each one. I tried binding an ftpd to each, and running separate instances of the ftpd. I tried virtual hosts.

NOTHING worked. I could either use one ftpd or the other. I could either connect via ssh on one IP or the other. the second I turned one NIC off stuff would work again. I messed with basic iproute commands, andnothng worked until I got this script to run, which allowed me to use each NIC independant of the other.

#ip route flush all

ip route del default dev eth1
ip route del default dev eth0

ip route del table 1
ip route add table 1 to default via dev eth1

ip route del table 2
ip route add table 2 to default via dev eth0

ip rule add from table 1
ip rule add from table 2

ip route add default via dev eth1
But now, samba client doesn't work. cifs mounting doesn't work either. It can't connect. Both work fine before I run the script.

BEFORE I ran that script, I could connect via ssh, or to the ftpd running on the machine using a LOCAL IP - AFTER, I have to use the external IP, or I cannot connect. I know that has something to do with it, but I do not have the advanced linux routing knowledge to redo the script or come up with a solution.