View Full Version : [ubuntu] Iptables for redirect ip traffic to new server with different ip

August 28th, 2012, 11:42 PM
Today I able to migrate some of the game servers to another server and needed some help to redirect the traffic from old ip to the new one.
SERVER1 ----- (internet ) -----> SERVER
I asume to use iptables to perform this, for that used this rule on my centOS box in the server1.

/etc/sysctl.conf: net.ipv4.ip_forward = 1

iptables -t nat -A PREROUTING -p udp --dest --dport 27015 -j DNAT --to-destination iptables -t nat -A POSTROUTING -j MASQUERADE iptables -t nat -A POSTROUTING -d -p udp --dport 27015 -j SNAT --to But the client cannot connect to the server from the old ip, the redirection don't started.