I have a situation where we have a server at a remote location. Its connection to the internet (say on ip 18.104.22.168) can be flaky so we have a backup connection on a different provider (say via ip 22.214.171.124). The first provider is way more economical, but when it goes down we would like to connect to that server through the second provider, who will charge for bandwidth use. The second provider is much more reliable but way more expensive.
I need to have a DNS entry to the remote server that typically points to 126.96.36.199 but can change to 188.8.131.52 as an alternative when the connection is no good or some other way of directing clients in the city to that remote server that goes through either connection reliably and invisibly to the client.
How might I approach this?
It seems like it might be solvable at the DNS level, but not with any of the technology I am aware of. What else might work?