I have a Raspberry Pi (OS: Raspbian, debian based), that is connected to a router via Ethernet and a GSM module via USB.
I have a situation where I need to switch internet access between two interfaces based on availability.
If the Ethernet (eth0
) does not have internet connectivity (but still connected to LAN), the GSM module (ppp0
) needs to be used. If the internet connectivity is available on eth0
, then eth0
should be used.
pi@raspberrypi:~ $ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
default 192.168.3.1 0.0.0.0 UG 202 0 0 eth0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.3.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
I want to know, is there any way if I can configure the routing in such a way that is is handled.
If not, then what command should I fire to switch different interface as primary (do I have to change metric?)