I am trying out something so this is my test setup:
- I have AWS VPC with a public and private subnet.
- I have a host in public subnet with a public IP address (say Host A)
- I have a host in private subnet running nginx on port 80 (Say host B with IP address
What I want to do
I want to access the Webserver on Host B from Internet by visiting Host A.
I setup IP forwarding parameter in
systctl.conf on host A and then put below
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 10.0.1.132:80
It is not working and I am not able to open the WebPage when I visit host A on port 80
Other info (with respect to AWS VPC Security Group):
- I have
port 80incoming access on
- I have
port 80outgoing access on
- I have incoming
port 80access on
Here is the kernel info:
# sysctl -p | grep forward net.ipv4.ip_forward = 1
Also, I am able to telnet on port 80 from Host A to host B on port 80. So this certifies that my AWS security group is working as expected.
I think I am going wrong on
IPtables part. Could help me figure out what is wrong in above setup.