We had to move some servers to another datacenter, and the customers dns provider was a bunch of n00bs so we had to respond on both ip’s for some time.
So we kept a virtualcenter in the old datacenter running this:
root@proxy:~# cat fw.sh
echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
iptables -t nat -F PREROUTING
iptables -t nat -A PREROUTING -p tcp –dport 80 -j DNAT –to-destination 22.214.171.124:80
iptables -t nat -A PREROUTING -p tcp –dport 443 -j DNAT –to-destination 126.96.36.199:443
iptables -t nat -A POSTROUTING -j MASQUERADE