Networking

Mikrotik Setup Multiple Virtual APs and VLANs

Mikrotik Setup Multiple Virtual APs and VLANs

Recently, I picked up a Mikrotik RB951G-2hnd for an additional AP to play around with in the lab and to eventually replace an aging Netgear SOHO router/AP that currently only handles wireless access traffic and doesn’t do any routing. ย I have used Mikrotik APs and really love the power and configurable options in the RouterOS software. ย You simply won’t find a more customizable router/AP out there to suite your needs if you like to configure and tinker. ย Mikrotik documentation is getting better, but knowing how to do something with Mikrotik equipment has always been the pain felt with their products. ย However, most of the time, you can find what you need on forums and such.

A topic that you see many ask about how to configure, is multiple virtual APs and VLANs. ย If you topology consists of aย  public wifi network as well as a private/admin network, setting up multiple APs withย VLAN tagging makes sense. ย Let me preface this configuration howto with this statement – there are a lot of ways to accomplish the same objective. ย Especially with the flexibility RouterOS gives you along with the plethora of configuration options, there are multiple solutions. ย There of course are always best practices, but I will show a couple of ways to configure RouterOS for traffic flow with multiple virtual APs and VLAN tagging.

For the sake of this post, we are configuring the RB951G as an access point only. ย Routing and DHCP are taking place upstream. ย Also, it is assumed that you are plugging the Mikrotik AP into an upstream switch with the appropriate VLANs untagged/tagged.

Configuring VLANs as their own interface

The first option to configure multiple virtual APs and VLANs is to create VLANs as their own interface then use bridges to tie the VLAN interfaces together with the appropriate virtual AP/LAN interface. ย So the tagging is done via the VLAN interfaces not the virtual AP. ย Let’s take a look at how this looks in Winbox.

VLAN interfaces

So let me explain something I have seen as a mistake when passing VLANs from the Mikrotik AP. ย For the sake of simplicity in our example here, we have a “private” VLAN and a “public” VLAN. ย You might think that you need to create (2) VLAN interfaces in RouterOS to handle both VLANs and we would if the upstream switch “untagged” VLAN ID is different than either two. ย In most simple network topologiesย however, the admin VLAN ID is the untagged ID of the upstream switch so we can simply leave these frames untagged coming from the Mikrotik. ย For many this untagged VLAN config on most switches is VLAN 1 which is not best practice for security, however, in many networks we find that VLAN 1 is usually left as the default admin VLAN. ย So untagged frames are in fact on VLAN 1 in that case.

So in RouterOS, if we are utilizing the untagged VLAN for connectivity to the private/admin side, we only need to create one VLAN interface to tag only the public side traffic for the correct network. ย The untagged private virtual AP would get its VLAN membership from the untagged VLAN on the upstream switch. ย We would in fact break things if we pulled double duty and tried to tag the frames from the Mikrotik and then also have the upstream switch trying to tag egress traffic as well – it wouldn’t work and traffic wouldn’t pass.

Navigate toย Interfaces in Winbox and create a new VLAN interface. ย In the example below, we have created a new VLAN 60 interface bound toย Ether1 interface on the Mikrotik RB951G as this is the “WAN” port or trunk port that will connect to the upstream switch.

mikrotik_vlan01

Virtual AP setup

On the virtual AP side, we have the standard AP or wlan1 by default and then we will configure one virtual AP for the public side. ย Notice below that we have the VLAN mode left set atย no tag. ย The private side wlan1_Admin VLAN config looks the same with no tag set as the VLAN mode option.

mikrotik_vlan02

Bridge Setup

For the bridge setup, we need (2) bridges to carry traffic from both VLANs. ย Name your bridges as intuitively as you can as it makes life easier to identify things down the road. ย Below we have:

  • lan_bridge – carries admin traffic
  • vlan60_bridge – carries public traffic

mikrotik_vlan03

Now we need to add our ports to the bridges created above:

  • ether1 and wlan1_Admin are both added to the lan_bridge toย connect the two
  • vlan60 and wlan_vlan60 are both added to the vlan60_bridge toย connect the two


mikrotik_vlan04

At this point, you should be able to correctly get a DHCP address assigned when connecting to the wlan1_Admin side as well as the public side. ย Keep in mind that all the other infrastructure involved to pass DHCP traffic must be in place

  • Scopes need to be set for both networks
  • Router options need set so the appropriate address is handed out from the correct pool
  • Switchport that your Mikrotik AP is plugged into needs to be tagged with all the VLANs that you want to pass traffic for

Simplifiedย Configuration

So above there are a few moving parts to make sure that VLAN traffic we want tagged on the correct virtual AP is setup correctly. ย Let’s take a look at a simplified approach to accomplishing the same thing that allows us to drop one of the bridges in favor of having the virtual AP tag the traffic itself, which makes more sense.

Virtual AP setup

In the simpler setup, we have no standalone VLAN interface that we have created. ย The VLAN tagging will get done by the virtual AP.

So we can see the difference already below. ย The virtual AP takes care of the VLAN tagging itself.

mikrotik_vlan05

 

 

Bridge Setup:

Using the single lan_bridge and no vlan60_bridge, we can bridge everything together on the single bridge – wlan1, vlan60_wlan, and ether1. ย Now our bridge setup is simple, one lan_bridge.

mikrotik_vlan06

Now we can bridge ether1, wlan1_Admin, and wlan_vlan60 together in the ports tab


mikrotik_vlan07

Traffic that is tagged by the Public wlan will pass to ether1 which is uplinked into a port tagged with the Public VLAN along with the private/admin VLAN. ย Untagged frames from our wlan1_Admin get tagged by uplink port. ย So traffic is directed correctly.

Final Thoughts

Once you get the hang of configuring Mikrotik with Winbox or even from the command line it is fairly simple to start making progress with your configs. ย Hopefully, the above information will point you in the right direction on getting your VLAN/virtual AP configuration hammered out.

 

 

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

One Comment

  1. Hi Lee,
    Is this same for controlled APs as well or is there any other ways to implements this on CAPs?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.