Hi.
I have an apache web server that I want to use from the LAN and from the WAN on the same url. I have everything working fine from the WAN after setting up port forward on port 80 HTTP, but nothing on the LAN can access the same domain and access the apache server despite NAT loopback being enabled on the port forward rule.
Anything else I need to do on the router to make this work (it used to work flawlessly on my ISP's router previously (a ZyXEL 8702N)? I really don't want to have to edit the hosts file on each computer on the LAN (or change DNS replies) for this to work.
First, NAT loopback on OpenWrt only relates to the host in the rule (i.e. the Apache server). Loopback should work from that IP address. For what you desire, you'll have to configure complex redirects to accomplish the task using NAT.
They read as such:
config redirect
option target 'DNAT'
option proto 'tcp'
option dest_ip '192.168.xxx.xxx'
option src_ip '192.168.xxx.0/24'
option src 'wan'
option dest 'lan'
option src_dport '80'
option dest_port '80'
option name 'REDIRECT_Web_LAN'
(LAN is the destination zone, even if your web server is in another zone, the redirect changes the destination IP form Public to Private.)
The other solution is to make a local DNS entry for the domain using the LAN IP address.
Thanks alot! That worked perfectly (after a close/open of my browser)!
If you post somehow to thank you (bitcoin, PayPal, etc other) I'd love to buy you a beer (or something equivalent).
Could I have found this out myself somehow? I googled a lot before creating an account and asking, but maybe my Google-fu failed me today? Is there some blatantly easy to find guide on this that I missed? I only found lots of bug reports etc. that seemingly got worked out when the original poster found his own error.