I have a community network in my apartment block where we all pitch in for two internet connections and then we all share them. I'm the admin for setting all this and am wondering if there is a way of switching between the two connections. Two ISP uplinks are of course running to a 3-nic'd Gentoo router.
Two balance the load under the two isp's I made this route
ip route add default scope global nexthop via (gateway1) dev eth0 weight 1 nexthop via (gateway2) dev eth1 weight 1
I have also, using iproute2, set up two tables, T1 and T2. T1 runs to ISP 1 and T2 runs to ISP 2, I'm using fwmark to make this happen.
ip rule add fwmark 1 table T1
ip rule add fwmark 2 table T2
So using an iptables command like
iptables -A PREROUTING -i eth2 -t mangle -p tcp --dport 22 -j MARK --set-mark 2
i can send all ssh traffic thru ISP 2. What I want to do is: If ISP 1 goes down then for the route to mark all packets with 2, or vice versa. Something to the effect of "if so many packets go answered in 'x' seconds then switch routes to this"
Now maybe I'm going about this wrong and ip and tc commands can't do this, but I don't know. Now I know that zebra has something called OSPF, open shortest path first, but I'm not quite sure if this will solve my problem. Plus can zebra and the ip command work in conjunction of each other.