Forward webtrafic during server migration

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
#!/bin/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 62.69.153.75:80
iptables -t nat -A PREROUTING -p tcp –dport 443 -j DNAT –to-destination 62.69.153.75:443

iptables -t nat -A POSTROUTING -j MASQUERADE

Dette indlæg blev udgivet i Knowledge Base, Linux, Old Base. Bogmærk permalinket.

Skriv et svar