LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can't forward port to internal linux box (https://www.linuxquestions.org/questions/linux-networking-3/cant-forward-port-to-internal-linux-box-428754/)

NetAX 03-26-2006 04:38 PM

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
This command reports 1
Code:

cat /proc/sys/net/ipv4/ip_forward
I am using SuSE 10 and have the firewall shut off for now. Can anybody tell me what I'm doing wrong?

RobertP 03-26-2006 06:50 PM

iptables -L

might show something unexpected. Also, check logs and give any warnings or error messages from iptables.

NetAX 03-26-2006 07:20 PM

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.