IPTables reroute traffic not working
- by user1307079
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.