AdminUser.wOrdpress.cOm

Archive for the ‘iptables’ Category

Redirecting network traffic to a new IP using iptables

Posted by: SiiN on: March 17, 2008

Login to the old server as root and enter the following
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -dport 80 -j DNAT –to-destination 1.2.3.4:80
iptables -t nat -A POSTROUTING -j MASQUERADE
Here the new ip address is 1.2.3.4. Now all the traffic to port 80 will get redirected to port 80 [...]