LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Cannot redirect traffic to new IP with iptables on centOS (http://www.linuxquestions.org/questions/linux-networking-3/cannot-redirect-traffic-to-new-ip-with-iptables-on-centos-4175424466/)

farenheitcx 08-28-2012 03:15 PM

Cannot redirect traffic to new IP with iptables on centOS
 
Hi, 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 1.1.1.1 ----- (internet ) -----> SERVER 2.2.2.2

I asume to use iptables to perform this, for that used this rule on my centOS box in the server1.

Quote:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -d 2.2.2.2 \
-p udp --dport 27015 -j SNAT --to 1.1.1.1


But the client cannot connect to the server from the old ip, the redirection don't started.

jschiwal 08-30-2012 01:12 AM

You need to use PREROUTING to redirect incoming traffic.

Here is a tutorial for doing the same thing: http://www.debuntu.org/how-to-redire...using-iptables


All times are GMT -5. The time now is 05:03 AM.