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.

  • Is it possible that both connections are online and one is used or do you want to bring up the backup ADSL line in case the active one fails? Are you willing to invest into a second usb/wifi dongle? With both conditions there is a nice solution supported by the kernel. – Ingo Dec 15 '18 at 18:21

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.

  • nah that's not what I'm looking for, perhaps I should Invest in a usb ethernet card so that both connections are active at same time for the pi – Allahjane Jan 16 '17 at 17:19
  • That's more-or-less what I was suggesting by using the RPi as your AP + router. It would be straightforward to run a script on the RPi to select the link with the fastest/best Internet link. Keep in mind, throughput is going to be limited by the RPi's USB bus. I found the RPi could pass about 10 Mbps, but couldn't keep up with faster rates. One other possibility would be a wifi router capable of running OpenWRT. You'll probably get better data rates. – bobstro Jan 16 '17 at 17:22

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.