ok, well in actual fact you *do* want two default routes, but with different metrics. this way the lower metric route will always be used, but should a test fail, that route can be removed and naturally fall back to the higher metric route. so with eth1 as the backup link...
Code:
route add default gw 192.168.2.1 metric 10
route add default gw 192.168.1.1 metric 20
and then under a cron job something like
Code:
ping -I eth0 64.233.167.99 -c3 > /dev/null
if [ $? ] then
route del default gw 192.168.1.1 metric 0
else
route add default gw 192.168.1.1 metric 0
fi
that's a very quick simplistic example, but hopefully it illustrates the example that if you can hit a google.com ip (obviously change for whatever you like...) then add a default route prefering that interface. if it fails, remove the route. one immediate shortcoming here is that there is no
status quo in place you change the routing tables, so technically it'd be better to only change it if a difference is required, but a simple grep would do that.