0

I have multiple model 3 Pi's deployed in remote offices with a wired internet connection coming from a Verizon LTE modem. Some of these devices are experiencing poor LTE connectivity, and are not reporting properly. I am thinking about also connecting these to the office WiFi networks with the onboard WiFi chip as a backup to the LTE connection.

How does the Pi handle multiple connections like this? Will it choose the "best" network at the time? Or can I set one connection as primary, and one as backup?

What is the best way to ensure that the Pi will receive an internet connection when provided with these two networks?

atwalsh
  • 101
  • 3
  • "*wired internet connection coming from a Verizon LTE modem*"? Then in the next sentence "*Some of these devices*" - what is the subject? Pi? LTE modem? – techraf Dec 05 '16 at 23:15
  • How is your LTE device connected to your Pi? USB? – HeatfanJohn Dec 06 '16 at 02:29
  • Your question is unclear. The **Pi** does nothing! - it depends how it is setup; the default for Raspbian uses `dhcpcd`. If a link goes down it should select another. You can change priority by setting `metric`. There is no simple way of selecting the "best" interface. John Heatfan's answer is a good explanation of gateway function. – Milliways Dec 06 '16 at 04:58

1 Answers1

2

Raspbian or the OS running on the Pi will use IP to route packets to their destination. By default the system will only have one default route (default gateway) which will receive all packets for any destination IP address that isn't in a connected network.

You should perform a netstat -rn and netstat -r~ command to see the routing table of your Pi. Thenetstatwith the n-option will display the routes without perform any reverse lookups. The default network is network0.0.0.0` and what ever address is specified for that network is the default gateway to which all non-connected IP addresses will be forwarded to.

By non-connected I mean any IP address that is in an IP network that isn't physically connected to your Pi. For example, if eth0 of your Pi is in network 192.168.1.0/24, then any IP packet destined to an address in that network will simply be transmitted out eth0. If you have no other connected networks then any packet for a network other than 192.168.1.0/24 will be forwarded to your default gateway for subsequent delivery to the destination address.

Since you have two connected interfaces (eth0 and your LTE device) you are going to need some sort of script that monitors the condition of the LTE connection and when your script detects that the LTE connection isn't working or isn't "strong" enough you need to switch to the eth0 connection.

See this answer for some idea how to accomplish this.

HeatfanJohn
  • 3,080
  • 3
  • 23
  • 36