I have a situation where I have a dual homed VOIP server that uses two internet connections. The solution works fine except for one problem, when the primary internet connection goes down, so does DNS resolution. This prevents my VOIP server from connecting to my VOIP provider on the backup internet connection because it can't resolve the DNS names for the servers. I can't use the IP's because the provider likes to move their servers around.
So my "workaround" plan is to update the HOSTS entries every x minutes on a cron job, this way unless the the primary internet is down for an extended period of time and the servers IP addresses change, i should be good.
However, I can't really think of a good way to do this, keeping in mind that if the dns entries can't be resolved, I don't want to overwrite them with blanks or error information.
Any suggestions?
EDIT:
Perhaps I wasn't quite clear. The reason I need to do this is because my VOIP provider likes to move their servers around. If I'm using a cacheing name server, and they move the servers, then i'll be hitting stale DNS data, and if I set the DNS cache time low enough then it defeats the purpose, because when the primary internet goes down, the cache will expire before it comes back up and i'm in the same boat.
What I need is a way to get the best of both worlds, which is the ability to react to DNS changes quickly, but not lose the ability to resolve if the connection goes down, thus the only solution I can think of is the updated hosts file.
Also, using OpenDNS doesn't solve anything because DNS lookups don't occur on the secondary net connection, they always go out on the primary one. This is the problem. Even though i've bound the app to two interfaces which use different net connections, it only does DNS lookup on the primary connection.