I have a RPi with 3 interfaces:

  • eth0 - standard ethernet
  • eth1 - GSM modem
  • wlan0 - WiFi

How can I automatically prioritise the interface that has access to the internet (eg. I can ping or google.com)?

The problem is, when the GSM modem has some problems (bad SIM card or poor signal) it is still up, eth1 has an IP (the modem is a Huawei e3372h), but no access to the global internet. The same situation is with wlan0, it can be connected to AP (so the interface is up), but the AP may be disconnected from the global internet.

How can I deal with such situations, eg. dynamically change the metric of each route? Do I need to write my service that periodically pings some external server eg. google and then changes the route metric?

Your Answer

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

Browse other questions tagged or ask your own question.