I'm working on an IOT home automation app using raspberry pi.
I'm using a 3G modem dongle as a fail-safe internet connection with a primary wifi connection.
If the primary connection fails, the system disconnects from the wifi, connects to the backup (3g) and then reconnects to the wifi lan.. This way It can access the internet and on the same time I can access the system through lan.
The problem is, once the system switches to the backup (3g) connection, It cannot detect when the problem with primary internet connection goes away..
I cannot find an effective way to overcome this problem:
- I can disable the 3g and check the primary connection every x minutes... but this approach is too expensive.
- I made a script to access the router page via curl and use the diagnostic tests to check for Internet. This is somewhat a better approach however, there is too many variables involved, It depends on the router model, password, etc.. if anything ever changed, everything breaks down.
- I can communicate with another machine on lan to check for internet instead but I don't like the idea of my system being dependent on another machine.
So anyone has a better approach? Could I keep 2 internet connections on the system?