OpenWrt Forum Archive

Topic: WAN failover

The content of this topic has been archived on 11 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm running OpenWRT 0.9 on my wrt54g3g-st which has a pcmcia slot for 3g cards. I've made several changes to the kernel, scripts and Webif², and I have nice 3g router setup going on.


I can set up two wan interfaces independently already, I 'created' another interface called wwan just for the 3g internet. Right now, I can manually toggle between the two, by using "ifup wan" or "ifup wwan" etc. I just need some advice on how to toggle them automatically.

I was thinking that I would create a hotplug script that starts a daemon when the wan interface goes up, but i'm not sure how i would have the bash script determine when the interface goes down. Any ideas would help me out a lot.

(Last edited by oldschoolinux38 on 19 Aug 2007, 02:39)

You can pickup your script in /etc/hotplug.d/iface/
Script will be executed each ifup or ifdown (wan down ...)

Here is ntpclient script wich has a part for ifup state and ifdown state :

#!/bin/sh

case "${ACTION:-ifup}" in
        ifup)
               code for ifup
        ;;
        ifdown)
                code for ifdown
        ;;
esac

(Last edited by Sonic on 20 Aug 2007, 01:39)

Is that script written for whiterussian? I don't see any nvram variables.

I haven't migrated to kamikaze yet because of the broadcom wireless support. I know that I could use the 2.4 kernel with kamikaze, but frankly I don't see the point because there currently seems to be more documentation on whiterussian and I don't want to have to jump through all the hoops of getting X-wrt on kamikaze.

ignore code in that script itself ...
(I have removed non-revelant code ...)

Ok, thats a lot easier to understand with out all the irrelevant ntpclient script. I didn't realize that that was just an example at first.. haha.

Well thats pretty much exactly what I was thinking, have hotplug run a watchdog script on ifup that monitors the physical connection to the net (via ping probably) and have that switch interfaces when it fails.

Do you think thats the most reliable way of doing this? I was thinking that there has to be another way to determine if the wan interface goes down.

The discussion might have continued from here.