DSL-Watchdog mit ISDN-Fallback
Dieses Watchdog-Script ermöglicht ein automatisches Fallback auf die ISDN-Wählleitung, falls der DSL-Zugang (PPPoE) ausfällt. Bei Wiederkehren der DSL-Verbindung wird die ISDN-Verbindung automatisch gekappt.
#!/bin/sh
################################################
# #
# DSL-Watchdog #
# #
# (c) 2004 Leonhard Fellermayr #
# #
################################################
while :; do
{
# DSL running && ISDN running => kill ISDN
test -e /proc/sys/net/ipv4/conf/ppp0/log_martians && \
test -e /proc/sys/net/ipv4/conf/ippp0/log_martians &&
{
echo -n "Killing ISDN..."
/sbin/isdnctrl hangup ippp0 >/dev/null 2>&1
/etc/rc.d/i4l stop >/dev/null 2>&1
# restore default route that was killed by i4l stop
GW=`/sbin/ifconfig ppp0 | grep "inet addr" | cut -f3 -d":" | cut -f1 -d" "`
/sbin/route add default gw $GW
/etc/fw/firewall ppp0
echo "`date` - DSL connection restored. Killing ISDN..." >> /var/log/dsl-watchdog.log
echo "done"
}
# DSL not running && ISDN not running => dial ISDN
test -e /proc/sys/net/ipv4/conf/ppp0/log_martians || \
test -e /proc/sys/net/ipv4/conf/ippp0/log_martians ||
{
echo -n "Dialing ISDN..."
/etc/rc.d/i4l start >/dev/null 2>&1
/sbin/isdnctrl dial ippp0 >/dev/null 2>&1
echo "`date` - No DSL connection! ISDN dial-up triggered." >> /var/log/dsl-watchdog.log
echo "done"
}
sleep 60
};
done

