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 220.127.116.11:80
iptables -t nat -A PREROUTING -p tcp –dport 443 -j DNAT –to-destination 18.104.22.168:443
iptables -t nat -A POSTROUTING -j MASQUERADE