I'm trying to set up VLANs to separate LAN, Guest, IoT, etc, but the Wiki isn't really extensive for cases where the switch is outside, and I'm at a loss.
Add both the iot and guest networks to the lan firewall zone (for now) and then reboot.
On the switch, you will need VLAN 20 added to at least one other port as it doesn't have a place to go (port 5 is the only port that is currently a member).
I would recommend that you test this (at the switch) by setting up a port per-VLAN. This only needs to be a quick test, but proves that everything is working. For example, keep port 1 as VLAN 1 untagged + PVID. Then port 2 can be VLA N 10 untagged + PVID, and port 3 will be VLAN 20 untagged + PVID. From there, you can connect your computer to each port to verify the VLAN is working.
Once all of that is done, you can adjust the firewall to achieve whatever specific goals you have for those networks (likely isolating them from your trusted lan) and then finally change the switch back to a config that is useful for your normal use and setup your APs.
Follow your instructions and everything works in the router.
Simplified for just lan + vlan.30 for the time being.
When connecting to port 1 in the switch (vlan.30 untagged) all is well. I get a proper 192.168.30.0/24 IP address, can reach vpn zone, resolve names, can't ping lan IPs, etc.
The AP itself, if set as DHCP client, will get an IP and connect. Ping openwrt.org from the AP's SSH also works.
When I connect to the AP wifi, though, the client doesn't get the dynamic IP.
This are AP's configs:
/etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option packet_steering '1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
config device
option name 'lan1'
option macaddr '***'
config device
option name 'lan2'
option macaddr '***'
config device
option name 'lan3'
option macaddr '***'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.10.3'
option netmask '255.255.255.0'
option ip6assign '60'
option gateway '192.168.10.1'
list dns '192.168.10.1'
config interface 'guest'
option device 'lan3.30'
option proto 'static'
option ipaddr '192.168.30.3'
option netmask '255.255.255.0'
option gateway '192.168.30.1'
list dns '192.168.30.1'
config device
option name 'wan'
option macaddr '***'
config device
option type 'bridge'
option name 'br-guest'
option bridge_empty '1'
option ipv6 '0'
Yup... as expected based on your config. You need to use DSA/bridge-VLAN constructs.
Ok. Previously we had been talking about VLANs 1, 10, and 20. All that matters is that the VLAN IDs are consistently defined in the router, the switch, and the AP. I'll use VLAN 30 for the AP. And, I'm going to assume that you're using port lan1 for the uplink, but if that's not true, you should be able to see how to adapt my recommendations:
Here's what you need to edit/add/delete on the AP.
Add bridge-VLANs:
config bridge-vlan
option device 'br-lan'
option vlan '1'
list ports 'lan1:u*'
list ports 'lan2:u*'
list ports 'lan3:u*'
config bridge-vlan
option device 'br-lan'
option vlan '30'
list ports 'lan1:t'
Edit the lan interface to use br-lan.1 like this:
config interface 'lan'
option device 'br-lan.1'
option proto 'static'
option ipaddr '192.168.10.3'
option netmask '255.255.255.0'
option ip6assign '60'
option gateway '192.168.10.1'
list dns '192.168.10.1'
Edit the guest network to be unmanaged and use br-lan.30. It will look like this when done:
config interface 'guest'
option device 'br-lan.30'
option proto 'none'
Since AP2 is connected to AP2 via a wireless backhaul, I don't know what I should use as port.
Otherwise /etc/config/network is identical to AP1 (except of course for IP and MAC addresses)