You'd need a program that periodically checks if
server1 is up, and executes the appropriate iptables rule (changing the port forward toward
server2) if it finds that it is down. If you
search LQ you'll probably find several examples of ping scripts that will execute stuff conditionally. I actually remember one specific
script posted by gbonvehi a couple years ago as a possible solution for someone's very similar needs.