2

I have two wifi enabled ADSL modems connected to internet from two different ISPs.

At times one of the line may go bad and I just connect to other wifi connection manually to continue the work.

Is there a way to enable automatic network switching in pi?

Like if one of the wifi AP is not connected to internet then pi must automatically connect to the second wifi AP.

Allahjane
  • 121
  • 1
  • 2

3 Answers3

1

Yes, an old question, but here is a solution for those who are googled it. What you want to have is a typical dynamic failover scenario. Linux has a professional solution integrated in its kernel. It is called bonding. This is configurable in several ways. For your use case you can use a backup configuration that uses a primary connection and when it fails, then it uses the backup line on the fly, also on just active connections. If the primary line comes back, it will be used again. But even if the backup line isn't used it must always be up and connected online so it can immediately be used. How to use it you can look at Howto migrate from networking to systemd-networkd with dynamic failover.

Ingo
  • 42,961
  • 20
  • 87
  • 207
1

There are two options

  1. Use Radiodan wifi AP - BEST SUITED
    This configures your Pi to be a temporary wifi hotspot when Pi not connected to any router. You access a url from your phone/browser and enter whichever wifi you want to connect. If your router is down, it repeats itself. Install using the automatic version from the guide. Its straight forward.

  2. From Raspberry Pi guide
    Scroll down to the section where it is mentioned - Adding multiple wireless network configurations

arjun
  • 141
  • 2
  • 12
0

If only one of your ADSL modems will be on (broadcasting its SSID) at a time, you can set a priority for SSIDs in /etc/wpa_supplicant/wpa_supplicant.conf. If both are broadcasting, but only one has a good Internet connection, this method will still connect to the one with the highest priority, so this solution may not be exactly what you're after. Another alternative would be to set up your AP (perhaps on a RPi) independently of the ADSL modems, and let it do your actual routing based on which link is up.

bobstro
  • 3,978
  • 15
  • 27