My home Internet connection (via Ethernet) is unreliable - when it's working I can get 90 Mbps, but around 50% of the time from 12pm to 10pm it is not working. When the home Internet is not working, I turn on the personal hotspot on my phone and switch to it on my laptop. After a while, I check if the Internet is back up by pinging through the Ethernet interface.
ping -I enp4s0 google.com
If the Ethernet connection is working, I switch back to it.
However, data is expensive, so I don't want to use it if the Ethernet connection is working. Having to manually check if it's working and switching back-and-forth is a slow process.
I am asking to see if there's a tool that will automatically check if the Internet is working via one Interface, and route traffic through that interface. But if it is not working, then route traffic through a backup interface.
I am using Ubuntu 18.04, but am looking for a generic Linux-based solution.
Note that I am not asking how to switch to Ethernet when it is plugged in. The Ethernet cable is always plugged in but the Internet may not be reachable from it.
wlp5s0
interface.