Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted

You could do something along these lines:

iptables -t nat -A OUTPUT -p all -d -j DNAT --to-destination 
iptables -t nat -A POSTROUTING -p all -j MASQUERADE
share|improve this answer

If you didn't have any NAT configured previously on this server, you may not have the kernel set to pass IPv4 traffic.

Make sure you have this in your /etc/sysctl.conf:

net.ipv4.ip_forward = 1
share|improve this answer
ip forwarding is enabled, but I have the same problem. – Kiwi Aug 28 '12 at 22:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.