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. The
netstatwith the n-option will display the routes without perform any reverse lookups. The default network is network
0.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.
dhcpcd
. If a link goes down it should select another. You can change priority by settingmetric
. 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