Eu resolvi o problema com o seguinte script de plano de fundo:
#!/bin/sh
PRIMARY=wlan0
SECONDARY=eth1
SLEEP=60
PING=8.8.8.8
CONDITION="100% packet loss"
while :
do
echo Init
ifmetric $PRIMARY 100
ifmetric $SECONDARY 200
if [ "'ip route | grep default | grep $PRIMARY'" = "" ];
then
ip route add default via 'ip route show | grep $PRIMARY | grep "scope link" | sed 's/\(.*\)0\/.*//''1 dev $PRIMARY
fi
if [ "'ip route | grep default | grep $SECONDARY'" = "" ];
then
ip route add default via 'ip route show | grep $SECONDARY | grep "scope link" | sed 's/\(.*\)0\/.*//''1 dev $SECONDARY
fi
ifmetric $PRIMARY 100
ifmetric $SECONDARY 200
echo Primary
while [ "'ping -I $PRIMARY -c 10 -w 20 $PING | grep \"$CONDITION\"'" = "" ];
do
sleep $SLEEP
done
echo Secondary
ifmetric $SECONDARY 50
while [ -n "'ping -I $PRIMARY -c 10 -w 20 $PING | grep \"$CONDITION\"'" ];
do
ifdown $PRIMARY
sleep $SLEEP
ifup $PRIMARY
sleep $SLEEP
done
done