I'm new to OpenWRT and I am slightly confused with VLANs and firewall zones. I have 3 physical interfaces, eth0 WAN, eth1 TEST, eth2 Contains VLAN interfaces.
I am on version 21.02.1.
eth2 is eth2.10 (LAN), eth2.20 (CCTV)
eth1 TEST, can access the internet fine.
eth2 VLANs, cannot access the internet or other zones but has the same setup as TEST eth2.10 (LAN)
input output forward masquerading
TEST => LAN & WAN - accept - accept - accept - unticked LAN => TEST & WAN - accept - accept - accept - unticked
Devices get IP addresses from the DHCP server associated to their VLAN, can ping default gateway, can talk layer 2 to other devices.
Please 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:
If this is an x86 or similar device that has each Ethernet port independently connected to the CPU (no hardware switch), you can omit the 802.1q devices and just create tagged vlans with the notation eth2.10 in a bridge or if there is only one physical port on the interface, right in the config interface.
Of course when a port is configured to emit tagged packets, the device on the other end of the cable needs to be VLAN aware and configured to accept those VLAN numbers.
When you are using a commercial VPN service to reroute all Internet use, you would configure forwarding from lan gaming etc to the openvpn zone and also enable masquerade on the vpn zone. If you want some Internet use to go via VPN and other directly through your ISP*, that will require vpn policy routing.
meaning Internet usage other than of course the link from the OpenVPN client running on the router to the VPN service has to go through the "raw" ISP. That exception is accounted for in conventional routing. It is not necessary to forward anything to wan in order for that to work.
The device is an APU4D4, not sure on specs in terms of hardware switch or not. The plan is to trunk those vlans down at least 1 physical interface, preferable 2, using LACP. Not sure on openWRT capabilities yet, as I am moving to this from pfSense.
The other end is a Meraki switch which is VLAN aware.
The vpn service is for a server/client connection between this host and a pfSense box. currently there will be no routing out to the internet via openvpn. But clients on lan, gaming should be able to talk to openvpn clients and vice versa.
Now if you wanted that interface active on more than one port you'd need to build a bridge, then attach layer 3 to it:
config device
option type 'bridge'
option name 'br-vlan20'
list ports 'eth2.20'
list ports 'eth1'
config interface 'vlan20'
option device 'br-vlan20'
option proto 'static'
option ipaddr '192.168.20.1/24'
...
Here the "vlan20" connects to eth1 untagged and eth2.20 tagged. This also enables layer 2 switching between the two Ethernet ports and the virtual CPU port which holds IP 192.168.20.1. Necessarily, the CPU is involved to simulate a hardware switch and move Ethernet-to-Ethernet packets, although on an x86 it is a negligible amount of CPU load.
This configuration syntax only works on devices without a hardware switch.