Add WLAN to a VLAN trunk

I have created a trunk with two VLANs on ether1 - one for management (VLAN 10) and one for a client network (VLAN 23).

I now want to add a WLAN1, to the client network. How can I do that?

If I use a cabled connection from ether2-4 i get access to the correct client network, but using WLAN1 i can’t seem to get it right.

I have tried the following:

  • creating VLAN 23 on ether1 and then creating a bridge using this with WLAN1
  • using ether1 as a bridge directly with WLAN1 and then configuring tagging on WLAN1

With neither of these, I got a connection from WLAN1 to the client network through the trunk.


Output of current “/export compact” with just the cabled connection working:

/interface ethernet
set [ find default-name=ether2 ] master-port=ether1
set [ find default-name=ether3 ] master-port=ether1
set [ find default-name=ether4 ] master-port=ether1
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n disabled=no mode=ap-bridge \
    ssid=TEST wireless-protocol=802.11 wps-mode=disabled
/interface vlan
add interface=ether1 name=ether1-vlan10 vlan-id=10
/interface ethernet switch port
set 0 vlan-header=add-if-missing vlan-mode=secure
set 1 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 2 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 3 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 5 vlan-mode=secure
/interface ethernet switch vlan
add independent-learning=yes ports=ether1,ether2,ether3,ether4 switch=switch1 \
    vlan-id=23
add independent-learning=yes ports=ether1,switch1-cpu switch=switch1 vlan-id=10
/ip address
add address=10.42.10.31/24 interface=ether1-vlan10 network=10.42.10.0
/ip route
add distance=1 gateway=10.42.10.1
/system leds
set 1 interface=wlan2
/system routerboard settings
set cpu-frequency=720MHz protected-routerboot=disabled

Any help will be appreciated.

This is pretty much what I want to accomplish.

As described the physical ports are working. I can get an IP address and access DNS from the port 2 of hAP AC and configure the hAP AC from a remote computer on VLAN 10.

I simply can’t get the WLAN1 on hAP AC to be a part of VLAN 23.

I think you can’t use “ethernet switch” device with WLAN. You will have to create a bridge and attach your interfaces (VLANs and WLAN).
Global performance might not be the same, as bridging is done by the CPU.

Do you have some recommendations based on the above configuration.

As explained, I have tried the following with no luck:

  • creating VLAN 23 on ether1 and then creating a bridge using this with WLAN1
  • using ether1 as a bridge directly with WLAN1 and then configuring tagging on WLAN1

At no point did the WLAN1 traffic go to the VLAN 23 trunk.

/interface vlan add name=Vlan23 vlan-id=23 interface=ether1  
/interface bridge add name="Access_vlan23"
/interface bridge port add bridge =Access_vlan23 interface=wlan1
/interface bridge port add bridge=Access_vlan23 interface=Vlan23

This config means that you recive tagged vlan 23 on ether1 and transform to untagged traffic on interface wlan1
Try to do this, and report back

Thank you for your help, unfortunately this don’t seem to solve the issue. WLAN1 is for some reason not bridged with VLAN23. If I use the physical ports ether2-4 i instantly get an IP address from DHCP on VLAN23. If I use WLAN1 i don’t.

Found the problem. Seems like “switch1-cpu” should be added for the VLAN switch, then everything is working as expected. The bridge from WLAN1 to ETHER1 was expected, but it didn’t work without “switch1-cpu” on the VLAN configured on the switch.

I’m new to MikroTik, so if someone care, please explain why this is needed for bridging the WLAN interface, but not the ETHER interfaces.

I also removed the VLAN interface on ETHER1, since it wasn’t needed, and configured a bridge between ETHER1 and WAN1. I then configured the VLAN on the WLAN1 instead. I later on tested by adding another VLAN to the switch (remember to add switch1-cpu as well), and configured a VAP (virtual AP) on this. It worked as well.

This is the final config that is working with the initial requirements:

# apr/09/2016 04:14:21 by RouterOS 6.34.4
# software id = 4A0F-K35L
#
/interface bridge
add name=br-wlan-ether1
/interface ethernet
set [ find default-name=ether2 ] master-port=ether1
set [ find default-name=ether3 ] master-port=ether1
set [ find default-name=ether4 ] master-port=ether1
set [ find default-name=ether5 ] master-port=ether1 poe-out=off
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n disabled=no mode=ap-bridge \
    ssid=TEST vlan-id=23 vlan-mode=use-tag wireless-protocol=802.11 wps-mode=disabled
/interface vlan
add interface=ether1 name=ether1.10 vlan-id=10
/interface ethernet switch port
set 0 vlan-header=add-if-missing vlan-mode=secure
set 1 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 2 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 3 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 4 default-vlan-id=23 vlan-header=always-strip vlan-mode=secure
set 5 vlan-mode=secure

/interface bridge port
add bridge=br-wlan-ether1 interface=wlan1
add bridge=br-wlan-ether1 interface=ether1
/interface ethernet switch vlan
add independent-learning=yes ports=ether1,ether2,ether3,ether4,ether5,switch1-cpu switch=switch1 vlan-id=23
add independent-learning=yes ports=ether1,switch1-cpu switch=switch1 vlan-id=10
/ip address
add address=10.42.10.31/24 interface=ether1.10 network=10.42.10.0
/ip route
add distance=1 gateway=10.42.10.1
/system leds
set 1 interface=wlan2
/system routerboard settings
set cpu-frequency=720MHz protected-routerboot=disabled

The idea is that this should completely isolate all VLAN on the router. If this is not correct, you are more than welcome to comment on this.

VLAN 23 seems unnecessary to me.

Treat is as VLAN 1 or default.

Put all the ports in a switch group.
Add VLAN 10 to the Bridge.
On your managed switch, set the untag ID of 10 for the port/ports where you want the other units to sit.

If you add WAPS or anything else… you can use any port on the Main router and tag or untag as needed on switches or WAPs.

I don’t like the idea of a default VLAN on a trunk port. I agree that you probably could.

The purpose is that more VLANs would be added later on, and that the physical ports could be part of any of these. I’m new to the MikroTik terms and methods, so could you explain why it would be better to add the management VLAN to the bridge instead of the physical management port?

Want more vlans… add them to the bridge. Un tag at switch or tag the ssids.

Could you please give a configuration example on how you would have done it. I’m not sure I understand what you try to do.

Isn’t the idea to have a little as possible added to the bridge since this is CPU, whereas the switch is hardware based?

The HAP AC is a wireless router in your config.

You have to tie the wireless to something. AKA the bridge.

The bridge will contain physical interfaces. The switch ports are physical interfaces. The wireless is a physical interface.

In order for the wireless and some port to be part of the same network… there has to be a bridge.

But isn’t this what has been done in the config?

/interface bridge
add name=br-wlan-ether1

/interface bridge port
add bridge=br-wlan-ether1 interface=wlan1
add bridge=br-wlan-ether1 interface=ether1

I just don’t understand why you want me to add the VLAN to the bridge instead of tagging in the WLAN configuration. What is the difference?