OpenWrt Forum Archive

Topic: Is there a working example for port forwarding in trunk?

The content of this topic has been archived on 19 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello

Can somebody post a working example of port forwarding in trunk from wan to lan? I have no success with that.

Thanks.

Jo:

Could you explain what the difference is between SNAT and DNAT?

I'm familiar with DNAT, but in what cases would you use SNAT?

Thanks.

marc.

jow wrote:

See http://wiki.openwrt.org/doc/uci/firewal … on.natdnat .
Keep in mind that you can't test port forwardings from the lan side, use a remote machine or web service for that.

~ JoW

Then is there a BUG in trunk. Open a port to WAN is working but not port forwarding.

Step by step what I do.

1. Open the Port 22 for ssh on the WRT54GS. I add the following code in /etc/config/firewall

config rule
        option src              wan
        option dest_port        22
        option target           ACCEPT
        option proto            tcp

Restart the firewall with:

/etc/init.d/firewall restart

Then testing the login from a machine in the «Internet» (ssh to a machine in the WAN an ssh back to my dyndns address). As a consequence no problem with dyndns and so on.
2. Forward port 80 to my webserver in the LAN. Adding the following code in /etc/config/firewall

config redirect
        option src              wan
        option src_dport        80
        option dest             lan
        option dest_ip          192.168.1.4
        option dest_port        80
        option proto            tcp

Restart the firewall and check on the machine in the «Internet» with wget:

-bash-3.2$ wget tomix.homelinux.org
--13:22:12--  http://tomix.homelinux.org/
Resolving tomix.homelinux.org... 84.72.167.47
Connecting to tomix.homelinux.org|84.72.167.47|:80... failed: Connection timed out.
Retrying.

I just get a time out. Before I used the WRT54GS not as a router and my ADSL-Router make the NAT translation and I just forward the port 80 on my ADSL-Router. Whereby I could exclude an error on the configuration of the webserver.
3. Add a section to open the port 80, as for ssh:

config rule
        option src              wan
        option dest_port        80
        option target           ACCEPT
        option proto            tcp

Still no success.

What I forget or is there really a BUG in trunk (Linux wifix 2.6.30.9 #1 Fri Nov 13 07:00:26 UTC 2009 mips GNU/Linux)?

I update to trunk, because I need a working wifi (working fine) and port forwarding. Which version can I should try?

Before I testing trunk my conclusion was:
kernel 2.4 working wifi but no port forward because of a bug
kernel 2.6 working port forward but no wifi
kernel 2.6 trunk working wifi and still working port forward

Is there somebody with a WRT54GS an trunk who can check if port forwarding work or not on his WRT54GS?

Thanks
tomix

The discussion might have continued from here.