Accessing a reverse proxy from subnet

Hi. Im new to OpenWRT and have setup my network like this:

Lan = 192.168.1.x
Vlan 3 = 192.168.3.x

Now I have a server running on 192.168.1.102. This server is running a reverse proxy with ngenx. It is working great. Externally, if I goto mydomain.com it takes me right to myip which I have configured in ngenx to head over to a lan ip and port.. if I goto mydomain.com from a computer on the lan, It also works.

The problem is when I goto mydomain.com from a computer on vlan3. then it just goes to my openwrt web interface. How come mydomain.com is not being forwarded over to 192.168.1.102 like traffic from the wan regular lan?

You can rebind the domain to the proxy LAN IP on the local DNS server:
https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#hostnames

That does not work. If I add for example mydomain.com hostname to forward to port 192.168.1.102:

mydomain.com from vlan3 still leads to the wan ip, so nothing has changed.
mydomain.com from the lan now leads directly to 192.168.1.102, which is my unraid servers webui login, rather than the swag container, which is even worse than before

I think I just hacked together a fix: I changed the interface "lan" (br-lan) to use a physical interface of eth0.1 AND 0.3, rather than just eth0.1. From my understanding, DNSmasq is providing local DNS resolution but only on the LAN interface, not any Vlan interfaces. So by bridging my lan interface to include vlan 3, it works. Now I just hope when I later setup rules to block wan traffic on vlan 3 it wont affect my vlan 1 lan interface (eth0.1) because they are physically bridged.

I spoke to soon. now my vlan 3 devices are just getting vlan1 Ips now that they are bridged interfaces. The real fix needed is how to apply local dns routing on interfaces other than lan.

The localservice option which is enabled by default should still allow access from your vlan subnet. There must be another problem.

Accept DNS queries only from hosts whose address is on a local subnet, ie a subnet for which an interface exists on the server.

1 Like