#vim /etc/sysctl.conf
(add new line)
net.ipv4.ip_forward=1
save and exit
The next step is to tell IPTables to redirect the traffic to the new server:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 122.164.34.240
Here’s where the IPTables magic happens. With the third and final step we tell IPTables to rewrite the origin of connections to the new server’s port 80 to appear to come from the old server.
iptables -t nat -A POSTROUTING -p tcp -d 122.164.34.240 --dport 80 -j MASQUERADE
The final step is required because if we don’t tell the web server of the new server that the connections are coming from the client machines, it would think that they are originating from the old server.
You may want to repeat this for the databases and email server port as well.
No comments:
Post a Comment