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.

1
  • 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
    Commented Dec 15, 2018 at 18:21

3 Answers 3

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

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.

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.

2
  • 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
    Commented Jan 16, 2017 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
    Commented Jan 16, 2017 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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