There is a TP-Link TL-WR740N router with OpenWrt 18.06.9 installed. The setup is: 1 SSID, bridged with switch and WAN port, so the router acts like an AP (DHCP disabled, just "converting ethernet to wifi").
With Unifi APs you can add another SSID with VLAN (so 1 SSID will be wihtout VLAN and 1 SSID will be with VLAN). How to do the same with OpenWRT?
Create a new interface and use tagging on the physical interface port, e.g eth0.10
Then create the ssid and assign it to the network of the interface you just created.
For example:
config interface 'iot'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '172.30.30.1'
option ifname 'eth0.3'
config interface 'guest'
option proto 'static'
option ifname 'eth0.2'
list ipaddr '172.17.17.1/24'
...
then assign the new ssids to guest and iot.
Thank you. I've figured out creating interfaces and assigning them, but I have an issue with VLANs.
By default there are no VLANs, for Unifi and for this OpenWRT. Then I add just VLAN 12, in Unifi I create a new SSID and assign VLAN 12 there. Now in Unifi I have the main network (without VLAN) and guest network (VLAN 12).
In OpenWRT I add VLAN 12 - by default it's off for all ports. I've tried all combinations, but I cannot figure out which combination allows 2 networks to work. I cannot set "untagged" for the other VLAN. If I set "tagged" for VLAN 12, it works, but the main network is down.
Please run the following commands (copy-paste the whole block) and paste the output here, using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have
The rollback of the configuration is a sign that communication was lost between the browser and the device. Maybe you are tagging the wrong port?
Take a look at this note.
There is only 1 cable connected, thus only one port used. If I have VLANs by default (VLAN 1 0t 1 2 3 4) - main network works. If I add VLAN 12 and set it tagged, VLAN 12 (guest network) works, but main network is down.
Bridged eth0.12, eth1.12 and guest radio to GUEST network
Everything works OK using eth1 (WAN port), but in eth0 (switch) works only guest (eth0.12). Is there any possibility I can make this work with eth0? In case someone smart enough switches cable from WAN port to any of switch ports.
Reading this, your problem seems to be, that port 1 is an untagged port belonging to vlan1 and at the same time a tagged port for vlan 12, which is not possible.
It is easy and straight forward to assign untagged ports to your guest vlan. You could e.g. assign port 1, 2 to lan and 3, 4 to guest, ...
But if you want to have a port belonging to both, lan and guest, it should be tagged on both. So your lan ports should be 0t 1t 2 3 4, your guest ports 0t 1t, your lan vlan1, your guest vlan12.
But normally port tagging is NOT exposed to end devices, it is just used between switches. So a switch connected to tagged port 1 could then expose lan and guest on different untagged ports.
If I set the port both tagged in VLAN 1 and VLAN 12, the main network goes down (I cannot access the router from main network, and I cannot access main network from main radio).
But, as I said, even with VLANs deleted from "Switch", it works with eth1 (WAN), but not with eth0 (switch). So is it possible to make it work with eth0? Or should I just put a sticker on eth0 ports with "do not use" label?
When you add tagging on vlan1, does the other end also add tagging?
Generally you need to have the switch configured to assign vlans to each port. However if you are trying to connect to the router with a pc the moment you tag vlan1 it will become unreachable. So you'd need to tag on the pc or whatever is connected to that port too.
Another solution is to create an SSID and assing it to an interface without attaching it to any physical ports. Then connect to that SSID and do your changes on both OpenWrt and the uplink router.
If you don't give all the details it's kinda hard to help you.
As a rule of thumb, if you tag on one side you'll have to tag on the other side too. Or use a managed switch to remove the tags on the devices that don't use vlan tagging.
What is connected on this port? Is it your pc? Is it a switch, managed or unmanaged?
Mikrotik RouterBoard internet gate with default settings.
A bunch of unmanaged switches
Unifi AP
OpenWrt AP (TP-Link).
At first there is only 1 network (192.168.88.0/24) and 1 SSID on Unifi AP and OpenWRT AP.
Then there is a requierement of a separate guest network. On Mikrotik I create a vlan12 interface, with 192.168.12.0/24 network and DHCP server. Then on Unifi controller I create second SSID and assign vlan 12 to it. Everything works perfectly.
Then I need to replicate the same functionality with OpenWrt (create second SSID and make it work only with vlan 12). It works with cable connected to eth1 (wan port): I just create a bridge of eth1.5 and wlan0-1 and it just works. However it does not work with cable connected to any port of eth0 (switch). If I add eth0.5 to the bridge with wlan0-1 - it just doesn't work. If I add vlan 12 to Switch - VLAN list tagged on eth0 ports, main network on OpenWrt is down.
The behavior of unmanaged switch with tagged frames is unpredictable. We have cases here where vlans were not propagated correctly over unmanaged switches.
What is the output of uci export network; swconfig dev eth0 show; brctl show
OK, but Unifi AP works with those switches. eth1 of OpenWrt also works. So...
With this config everything works OK when uplink cable goes to eth1 and only vlan12 (guest network) works if uplink cable goes to eth0 (any switch (yellow) port of router):