OpenWrt Forum Archive

Topic: Port forwarding problem

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

Hello everyone!
I'm trying to setup port forwarding on my wr740n (BARRIER BREAKER 14.07, r42625)
Wr740n's  lan - 192.168.2.0/24, wan - 192.168.1.111 (yes, it connected to another lan for testing purposes)

I have server in my openwrt lan (192.168.2.2 for example) with ht***p server on port 80, and it reachable from openwrt (tested with wget).
And i have a rule in /etc/config/firewall (created from luci web interface), which listens port 8080 in wan and redirects it to 80 in lan, ip 192.168.2.2
But when i try to connect to it from .1.0/24 lan (for example, 192.168.1.111:8080), nothing works ..

I trying to disable firewall (/etc/init.d/firewall disable), but still no results..

Please, tell me how i can solve my problem!

/ etc/config/firewall (last rule)

config redirect
        option target 'DNAT'
        option src 'wan'
        option dest 'lan'
        option proto 'tcp udp'
        option src_dport '8080'
        option dest_ip '192.168.2.2'
        option dest_port '80'
        option name 'Webserver'

When you make your test from the router, the server is receiving traffic from the 192.168.1.111 address; however, when you try to reach through the redirection, the server sees traffic coming from a 192.168.2.x address. I would check that the firewall (and the web server, too) in that machine are configured to admit such traffic.

Web server is configured to accept any ip address and firewall is disabled,

UPD: problem solved, i simply forgot to add gateway on server.

But there is another problem: when i'm trying to do this with my VPN, it doesnt work.
I've added new rule, which listens port 8081 on LAN and redirects it to port 80 to host 192.168.2.2.

When i try to connect it from OpenWrt LAN (for example, from host 192.168.2.25), it works fine.
But when i do the same from my VPN, it doesnt work.

postimg.org/image/e27tjlmwz/
postimg.org/image/z0dzhomrn/

I have the same issue and I hope you will get tips from internet and you can easily sort out the problem by using the tips.

How is your VPN configured?

Problem solved, thanks for all!

I added new Zone in Network>Firewall>General settings (Forwarding from VPN to WAN, input/output/forwarding accepted, covered network - VPN (this is name for virtual interface covers tun0)), and into port forwarding settings source zone must be "VPN', not LAN. After this all working fine.

The discussion might have continued from here.