VLANs let you split one physical network into several separate ones: a main LAN, a network for smart-home devices, a guest network and so on. On MikroTik RouterOS 7, the recommended way to do this is bridge VLAN filtering. This guide builds a small, working example: a router with two access ports, one trunk port to an access point or switch, and two VLANs.
The example network
- VLAN 10: main LAN, subnet
192.168.10.0/24. - VLAN 20: IoT devices, subnet
192.168.20.0/24. - ether2: access port for VLAN 10 (a computer, untagged).
- ether3: access port for VLAN 20 (an IoT device, untagged).
- ether5: trunk port to a switch or access point, carrying VLANs 10 and 20 tagged.
Port names and addresses are examples. Make a backup and keep Safe Mode ready, because VLAN filtering can cut off your own connection.
Key concepts
- Access port: carries one VLAN, and frames leave the port without a tag. The device on it does not know about VLANs.
- Trunk port: carries several VLANs, and frames have tags.
- PVID: the VLAN that untagged incoming frames on a port are assigned to.
- The bridge itself is a port too. For the router to have an address in a VLAN, the bridge must be a tagged member of that VLAN.
Step 1: Create the bridge (filtering off for now)
/interface bridge
add name=bridge1 vlan-filtering=no
Step 2: Add the ports with their PVIDs
/interface bridge port
add bridge=bridge1 interface=ether2 pvid=10 frame-types=admit-only-untagged-and-priority-tagged
add bridge=bridge1 interface=ether3 pvid=20 frame-types=admit-only-untagged-and-priority-tagged
add bridge=bridge1 interface=ether5 frame-types=admit-only-vlan-tagged
Access ports accept only untagged traffic and assign it to their VLAN. The trunk accepts only tagged traffic.
Step 3: Fill the bridge VLAN table
/interface bridge vlan
add bridge=bridge1 vlan-ids=10 tagged=bridge1,ether5 untagged=ether2
add bridge=bridge1 vlan-ids=20 tagged=bridge1,ether5 untagged=ether3
For each VLAN you list where it is tagged (the trunk and the bridge itself) and where it leaves untagged (the access port).
Step 4: Create VLAN interfaces and addresses on the router
/interface vlan
add name=vlan10 interface=bridge1 vlan-id=10
add name=vlan20 interface=bridge1 vlan-id=20
/ip address
add address=192.168.10.1/24 interface=vlan10
add address=192.168.20.1/24 interface=vlan20
Step 5: DHCP for each VLAN
/ip pool
add name=pool10 ranges=192.168.10.100-192.168.10.200
add name=pool20 ranges=192.168.20.100-192.168.20.200
/ip dhcp-server
add name=dhcp10 interface=vlan10 address-pool=pool10 disabled=no
add name=dhcp20 interface=vlan20 address-pool=pool20 disabled=no
/ip dhcp-server network
add address=192.168.10.0/24 gateway=192.168.10.1 dns-server=192.168.10.1
add address=192.168.20.0/24 gateway=192.168.20.1 dns-server=192.168.20.1
[ADD: a screenshot of your Bridge > VLANs table]
Step 6: Interface lists and firewall
Put VLAN 10 in your LAN list and treat VLAN 20 like a guest network: internet access only, and no access to the LAN or the router’s management. Use the same firewall approach as in our guest Wi-Fi guide:
/interface list member
add list=LAN interface=vlan10
add list=GUEST interface=vlan20
/ip firewall filter
add chain=input action=accept in-interface=vlan20 protocol=udp dst-port=53,67 comment="IoT DHCP and DNS" \
place-before=[find where comment="drop everything not from LAN"]
add chain=forward action=drop in-interface=vlan20 out-interface-list=!WAN comment="IoT: internet only" \
place-before=[find where comment="drop new connections from WAN that are not port forwards"]
Create the GUEST list first if you do not have it yet. Note that DNS also needs TCP port 53 in some cases, so add a TCP rule as in the guest guide if you see DNS problems.
Step 7: Turn on VLAN filtering last
/interface bridge set bridge1 vlan-filtering=yes
Do this only when everything above is in place, from a port that is configured correctly, and with Safe Mode on. If you manage the router through the bridge while filtering is switched on without the right VLAN entries, you lose access. A common safety measure is to leave one port outside the bridge, with its own address, only for management.
Configure the other end of the trunk
The device on the other side of ether5 (a switch or an access point) must be set up for the same VLAN IDs, tagged on its uplink port. For a Wi-Fi access point, map each SSID to its VLAN. A mismatch of VLAN IDs between the devices is a very common reason for “it does not work”.
Check that it works
- Connect a computer to
ether2. It should get an address like192.168.10.x. - Connect a device to
ether3. It should get192.168.20.xand have internet access, but no access to VLAN 10. - Check
/interface bridge host printto see which MAC addresses appear in which VLAN. - Check
/interface bridge port printfor the hardware offload flagH. Hardware offload with VLAN filtering is supported only on some devices, so check your model’s documentation if speed matters.
Common mistakes
- Forgetting
bridge1in thetaggedlist, so the router has no connection to the VLAN. - Turning on
vlan-filteringbefore the VLAN table and PVIDs are ready. - Wrong
frame-typesor PVID on a port. - Different VLAN IDs on the router and the switch or access point.
- Forgetting a DHCP server or firewall rules for the new VLAN.
- Mixing the old method (VLAN interfaces on physical ports) with bridge VLAN filtering.
Checklist
- Bridge, ports, PVIDs and frame types are set.
- Bridge VLAN table lists tagged and untagged members for each VLAN.
- VLAN interfaces, addresses and DHCP servers exist.
- Firewall rules separate the VLANs the way you want.
- The trunk partner uses the same VLAN IDs.
- VLAN filtering was enabled last, with Safe Mode and a backup.

