I have a CentOS server running Centreon (a monitoring solution similar to Nagios) to monitor devices in multiple networks. The server could access the internet via 4 different gateways/routers, each having its own physical internet connection (ADSL and/or LTE).
Right now I have set one of them as gateway and if this line fails, the server can no longer reach the internet. How can I automatically switch to another gateway if one fails?
This also raises the question: how can I detect that an internet connection has failed?
- pinging the router would only detect failures between the server and the router
- Checking via SNMP if DSL is considered
upleads to many false positives. Because somehow the DSL is up/synced but the problem seems to be on the provider side. - pinging a host in the internet might lead to false negatives if this host fails. Also: which host should I ping?
- Google DNS (8.8.8.8 and 8.8.4.4) might fail sometimes
- DNS server of provider changes from time to time
- first hop after router: also changes sometimes
- pinging one of the other gateways also leads to false negatives
The next question would be: How can I check which of the other three connections are still working?