Can't forward port to internal linux box
I have a test environment where I have one linux box acting as the NAT box. From the NAT box I am able to access port 222 (The "internal" linux box) with no problem.
If I try to access port 222 via the "WAN" IP address of the NAT box I cannot get through. NAT box: eth0 10.0.0.3 (connected to internal machine network) eth1 172.17.64.202 ("WAN" IP address) Internal box: eth1 10.0.0.1 I have tried using the following commands which do not work for me: Code:
iptables -t nat -A PREROUTING -p TCP -i eth1 -d 172.17.64.202 --dport 222 -j DNAT --to-destination 10.0.0.1:222 Code:
iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE Code:
cat /proc/sys/net/ipv4/ip_forward |
iptables -L
might show something unexpected. Also, check logs and give any warnings or error messages from iptables. |
I figure it out. I used the wrong interface for POSTROUTING.:D
Code:
iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE |
All times are GMT -5. The time now is 05:28 AM. |