Hello,
I've set up five different subnets on my router.
192.168.1.1/24 DHCP on physical LAN ports 1,2 - routed to WAN
192.168.2.1/24 DHCP on physical LAN port 4 - routed to WAN
192.168.3.1/24 DHCP on physical LAN port 3 - routed to VPN via APR
10.2.0.2/32 VPN routed to WAN
192.168.0.X/24 - WAN DHCP on physical port WAN
The problem is, any of those subnets can be accessed from the others.
For exampe, I've set up SSH on 192.168.1.1 but I can connect to it from 192.168.2.X.
Or I can ping 192.168.3.1 from 192.168.1.X.
How can I isolate all internal traffic such that subnets 1.1 and 1.2 can access only WAN, 1.3 - only the VPN, and I can ssh the router only on the 1.1 subnet?
I don't know that we have enough information to answer the question, but I'm going to make some assumptions:
I'm assuming each of those subnets is associated with a VLAN that is mapped to the LAN ports you've specified.
I assume you have an interface on the router for each of the VLANs.
Those should be pretty safe assumptions given what you've described. Based on those, my best guess is that you've put all of your LAN interfaces in the LAN firewall zone. By default, the router will allow traffic between interfaces in the same zone. What you should do is create a separate zone for each interface and then use the firewall rules to control which zones can communicate with others.
Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
Based on your configs (at least my quick read through), I would expect that each of the subnets should be isolated from the others. Is that not the case?
This is a special case... this is not inter-vlan routing. It is one of the addresses that the router has, and it will respond because you have each of the zone INPUT rules set to ACCEPT.
Try connecting from a host on one network to a host on any other network and vice versa, as long as the host is not the router itself (i.e. literally the router, or an address that the router actually holds on each network).
I see. Can I block access to the router itself from all but one subnet?
If I set the INPUT and/or OUTPUT zone policy to REJECT, it effectively rejects the whole traffic.
Input = REJECT will prevent access to the router itself. You'll likely need to create rules to allow DHCP and usually also DNS.
The firewall configuration section of the guest wifi tutorial demonstrates how to do this.
The output rule should be accept in the vast majority of cases -- without it you won't be able to route because traffic destined for other zones (including the internet) will not be allowed out of the firewall if you set it to reject or drop.