Fallback when WAN connection is lost
In the example below, the VPN connection is tested every 15 minutes while the eWON is using the factory LAN.
If the VPN connection is lost, the eWON switches over to the modem connection. After two hours, it checks to see if the Ethernet WAN (using the factory LAN connection) is available again and switches back if it is.
Rem --- eWON start section: Init Section ewon_init_section: Rem --- eWON user (start) ONTIMER 1,"goto TestVPN" TSET 1,900 REM --- WAN_ON is a MEM tag used to store the state of the Ethernet connection WAN_ON@=1 ONTIMER 2,"goto ReturnToWAN" TSET 2,0 Rem --- eWON user (end) End Rem --- eWON end section: Init Section Rem --- eWON start section: Fallback Rem --- eWON user (start) TestVPN: SETSYS INF,"load" A$ = GETSYS INF,"VPNIP" PRINT Time$;" ";A$ IF (A$="0.0.0.0") THEN REM WAN is broken, activate Fallback WAN_ON@=0 TSET 1,0 TSET 2,7200 SETSYS COM,"load" SETSYS COM,"WanCnx",1 SETSYS COM,"save" PRINT Time$;" Fallback activated" LOGEVENT "Fallback activated" ELSE WAN_ON@=1 ENDIF END ReturnToWAN: TSET 2,0 SETSYS COM,"load" SETSYS COM,"WanCnx",2 SETSYS COM,"save" PRINT Time$;"Fallback deactivated" LOGEVENT "Fallback deactivated" TSET 1,900 END Rem --- eWON user (end) End Rem --- eWON end section: Fallback
Another solution is to use the WAN Fallback feature which is natively embedded in the Cosy 131 and Flexy family.
The principle is the following one: you configure a primary WAN connection as well as a secondary WAN connection. The eWON tests on a periodically time interval if the primary WAN connection is active. If not it switches to the secondary WAN interface. After a defined time, it testes the primary interface. If the primary is back online, it returns to the primary interface, if not, it stays on the secondary for a next test.
More information in the Knowledge Base: WAN Fallback.