Port Forwarding Using iptables on Ubuntu

Posted by user141610 on Server Fault See other posts from Server Fault or by user141610
Published on 2012-10-18T10:04:00Z Indexed on 2012/10/18 11:03 UTC
Read the original article Hit count: 212

This is the scenario. I have configured a web-server in MUX. Now I want to access that web-server from Internet. Ubuntu box has two interfaces, One is connected to WAN (Public IP) and another one is connected to MUX (Private IP). MUX has no option to insert default gateway.

iptables -t nat -A PREROUTING -p tcp -i eth0 -d 103.x.x.x --dport 8001 -j DNAT --to-destination 192.168.1.2:8080
iptables -A FORWARD -p tcp -d 192.168.1.2 --dport 8080 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

It does not work.

Thanks...

© Server Fault or respective owner

Related posts about iptables

Related posts about port-forwarding