VLANs

MikroTik VLAN Configuration with Bridge VLAN Filtering

Create VLANs on a MikroTik router the modern way with bridge VLAN filtering: access ports, a trunk port, VLAN interfaces with their own subnets, and how to avoid locking yourself out.

Commands in this article follow RouterOS v7 documentation but have not yet been marked as lab-tested on this site. Always test changes in a lab or maintenance window and keep a backup.

Problem

You want separate networks (for example Staff on VLAN 10 and Guests on VLAN 20) on one MikroTik router or switch, with access ports for PCs and a trunk port to another switch or access point.

Symptoms

  • Devices on different ports can still see each other.
  • After turning on VLAN filtering you lost access to the router.
  • Tagged traffic from the trunk does not reach the right subnet.

Likely causes

Older guides use VLAN interfaces on physical ports or the switch chip menu. Since RouterOS v6.41 the recommended method is bridge VLAN filtering: one bridge, a PVID per access port, and a VLAN table that says which ports are tagged or untagged.

Prerequisites

  • Plan: ether2 = Staff access (VLAN 10), ether3 = Guest access (VLAN 20), ether5 = trunk with both VLANs tagged.
  • Manage the router from a port that stays reachable, or use WinBox Safe Mode.

Solution (WinBox / CLI)

1. Bridge and ports (VLAN filtering stays off until the end):

RouterOS CLI
/interface bridge add name=bridge1 vlan-filtering=no
/interface bridge port add bridge=bridge1 interface=ether2 pvid=10
/interface bridge port add bridge=bridge1 interface=ether3 pvid=20
/interface bridge port add bridge=bridge1 interface=ether5

2. VLAN table. The bridge itself is tagged so the router can route the VLANs:

RouterOS CLI
/interface bridge vlan add bridge=bridge1 vlan-ids=10 tagged=bridge1,ether5 untagged=ether2
/interface bridge vlan add bridge=bridge1 vlan-ids=20 tagged=bridge1,ether5 untagged=ether3

3. VLAN interfaces and addresses for routing:

RouterOS CLI
/interface vlan add interface=bridge1 name=vlan10-staff vlan-id=10
/interface vlan add interface=bridge1 name=vlan20-guest vlan-id=20
/ip address add address=192.168.10.1/24 interface=vlan10-staff
/ip address add address=192.168.20.1/24 interface=vlan20-guest

Add a DHCP server on each VLAN interface (see Basic internet setup) and add both VLAN interfaces to the LAN interface list.

4. Turn VLAN filtering on last:

RouterOS CLI
/interface bridge set bridge1 vlan-filtering=yes

Warning: If you manage the router through a port on this bridge, give that port a PVID and a management VLAN interface first, or you will lose access the moment filtering is enabled.

Verification

RouterOS CLI
/interface bridge vlan print
/interface bridge port print

A PC on ether2 gets a 192.168.10.x address, a PC on ether3 gets 192.168.20.x, and the switch on ether5 receives both VLANs tagged.

Common errors

  • Forgot bridge1 in the tagged list: the VLANs work as a switch but the router cannot route them.
  • Turned on filtering before building the VLAN table: access lost.
  • Guests can reach Staff: VLANs separate Layer 2 only. Add a forward rule to drop traffic from vlan20-guest to 192.168.10.0/24.

Rollback

RouterOS CLI
/interface bridge set bridge1 vlan-filtering=no

With filtering off, the bridge forwards all ports together again.

Go deeper in class

This topic is covered hands-on in MTCSWE — MikroTik Certified Switching Engineer.

View MTCSWE
WhatsApp