Dual WAN router, update bind9 behind NAT with current connection
Hi,
I've got a dual WAN router (linksys RV082) with 2 static ip addresses.
I have a variety of serves behind the router, including web, mail, and my own bind9 dns hosting a bunch of my own domains. They router has NAT enabled and uses port forwarding to direct to the correct servers internally.
My domains have 2 mx records and 2 ns records, one for each of my static IP addresses, but which in reality point to the same servers. so MX1 and MX2 point to the same mail server and NS1 and NS2 point to the same name server, though through 2 different public IPs.
My problem and question revolves around my bind9 name server when my primary internet connection is down. Because of the 2 mx and ns records, I am able to reach the mail server and dns server ok, but the ip address that the name server resolves for any server is the primary one, which is down. So even though I have backup internet connection, you can't reach my web server without using the ip address.
What I am after is a script or method, perhaps using nsupdate and ddclient, which will dynamically update some ns records on my dns server whenever the primary connection is down, and conversely when it comes back up.
The linksys box is a linux based box, but I'm not sure that it allows much querying. It does have a dyndns.org feature, which I have activated, but each WAN port registers to a seperate dyndns.org domain, so WAN1 is mydomain.dyndns.biz and WAN2 is mydomain2.dyndns.biz.
The other idea would be a script to check a site like whatismyip.com to get my puplic ip address and update accordingly.
Not sure how to accomplish this, any help would be appreciated.
Thanks,
Mark