I'm trying to use iptables
to forward incoming traffic on port 80 to a web server running on another IP address and port. Not that it appears to make a difference, the web server is running in a Docker container on port 3000. Here's what I've done so far.
Forward incoming traffic on 80 to the web server:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 172.17.x.x:3000
Remap traffic returning from the web server so the client sees the correct source address:
sudo iptables -t NAT POSTROUTING -s [web server IP address] -j SNAT --to-source 10.0.y.y
However when I view my rules with iptables -L
, neither are showing up and I can't access the site from the host's public address. My host is running Ubuntu 14.04 (Trusty) and port forwarding is enabled.
iptables -L -n -t nat
to list nat rules exclusively.