iptables NAT configuration

Posted by Sarp Kaya on Server Fault See other posts from Server Fault or by Sarp Kaya
Published on 2012-10-06T11:11:47Z Indexed on 2012/10/06 15:39 UTC
Read the original article Hit count: 301

Filed under:
|

Hello I am experiencing some issues with my iptables. Here's what I want to do:

A(eth0)--------(eth0)B(eth2)---------------(eth2)C

Brackets are interface names A,B and C are hosts. Now I would like to forward port number 80 of host C so that It would be accessed via host A. host A is 192.168.1.254 host C is 192.168.3.2

I intentionally ACCEPTed all FILTER chain options as the default policy because I wanted to make sure that NAT is working properly first. I enabled ip_forward.

So here's what I have done:

sudo iptables -A PREROUTING -t nat -p tcp - d 192.168.1.254 -j DNAT --to 192.168.3.2

However it is not working. What am I missing here?

© Server Fault or respective owner

Related posts about iptables

Related posts about nat