IPTables reroute traffic not working

Posted by user1307079 on Server Fault See other posts from Server Fault or by user1307079
Published on 2013-06-30T04:34:37Z Indexed on 2013/06/30 10:22 UTC
Read the original article Hit count: 284

Filed under:
|

I am trying to reroute incoming traffic on my server's port 80 to another server, but it is not working. This is what I tried. On the host server, I ran these:

echo “1? > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 38.105.20.226:80
iptables -t nat -A POSTROUTING -j MASQUERADE

The server I want it to redirect to is 38.105.20.226:80, but when I go to the webserver that is on the main server, instead of showing the content of the web server on 38.105.20.226:80, it just doesn't load. I am on CentOS.

© Server Fault or respective owner

Related posts about centos

Related posts about iptables