26/10/2026
MikroTik VLAN Setup with Bridge VLAN Filtering
In a lot of companies everything still sits on one flat network. This post shows how to set up a MikroTik VLAN the right way, with Bridge VLAN Filtering, on RouterOS v7.
In a lot of companies everything still sits on one flat network. Accounting, cameras, printers, guest Wi-Fi, all side by side. That means a guest on the Wi-Fi is basically on the same network as the finance server.
The fix is VLANs. On enterprise and multi-branch networks, this is one of the first things the ITcorv team does. This post shows how to set up a MikroTik VLAN the right way, with Bridge VLAN Filtering, on RouterOS v7.
What is a VLAN?
A VLAN splits one physical switch into several separate networks. Each VLAN has a number (the VLAN ID), and devices in a VLAN only see each other. If traffic needs to go between two VLANs, it has to go through the router, and that's where your firewall decides what's allowed.
Three terms you need:
- Access port: a port with a normal PC or printer on it. Its traffic is untagged, and the switch adds the tag itself.
- Trunk port: a port that carries several VLANs at once, for example the uplink to another switch or an access point. Its traffic is tagged.
- PVID: the VLAN ID MikroTik puts on untagged traffic coming into a port. You set it on access ports.
Why Bridge VLAN Filtering?
MikroTik has a few ways to do VLANs, and plenty of people still use the old ones, like creating a VLAN interface directly on a physical port that's also in a bridge. MikroTik's own docs list that as a common misconfiguration that causes either performance or connectivity problems.
The method MikroTik recommends is Bridge VLAN Filtering. You put all the ports in one bridge, then in the bridge VLAN table you say which VLAN is tagged or untagged on which port.
One note: on some models, turning on vlan-filtering means the switch chip stops handling the traffic and the CPU takes the load. Before you start, check your model in the Bridge Hardware Offloading table. The CRS3xx series does it in hardware.
Our scenario
One MikroTik acting as both router and switch:
ether1: internet (WAN)ether2: a PC on the office VLANether3: a device on the camera VLANether5: trunk to another switch or access pointether8: a separate port, outside the bridge, so you don't lose access while configuring
VLANs:
| VLAN | Name | Network | |---|---|---| | 10 | Office | 10.10.10.0/24 | | 20 | Cameras | 10.10.20.0/24 | | 30 | Guest | 10.10.30.0/24 | | 99 | Management | 10.10.99.0/24 |
Swap the addresses and port numbers for your own.
Sample MikroTik VLAN config
Before you start:
- Connect through
ether8or a serial console, not a bridge port. MikroTik itself warns you may lose access when you enable vlan-filtering. - Turn on Safe Mode (
Ctrl+Xin the terminal). If you get cut off, the router rolls the changes back. - Take a backup.
1) Create the bridge (vlan-filtering off for now)
/interface bridge
add name=bridge1 vlan-filtering=noWe turn vlan-filtering on at the very end. If you turn it on now, before management access exists, you can lock yourself out.
2) Add ports with PVID
/interface bridge port
add bridge=bridge1 interface=ether2 pvid=10
add bridge=bridge1 interface=ether3 pvid=20
add bridge=bridge1 interface=ether5ether2 and ether3 are access ports, so they get a PVID. ether5 is the trunk and doesn't need one.
3) Bridge VLAN table
/interface bridge vlan
add bridge=bridge1 tagged=bridge1,ether5 untagged=ether2 vlan-ids=10
add bridge=bridge1 tagged=bridge1,ether5 untagged=ether3 vlan-ids=20
add bridge=bridge1 tagged=bridge1,ether5 vlan-ids=30
add bridge=bridge1 tagged=bridge1,ether5 vlan-ids=99Why is bridge1 tagged too? The bridge itself is the router's CPU port. If the router is going to route between VLANs, hand out DHCP, or be reachable on the management VLAN, it has to be a member of that VLAN.
A very common mistake: never put several VLANs on one line for access ports. This is wrong:
# wrong, don't do this
add bridge=bridge1 tagged=ether5 untagged=ether2,ether3 vlan-ids=10,20With this line, VLAN 10 and 20 both go out of both ports, and your separation is gone. MikroTik's docs say it plainly: one VLAN ID per entry for access ports. Multiple VLANs on one line are only fine for trunks.
4) VLAN interfaces and IP addresses
/interface vlan
add interface=bridge1 name=vlan10-office vlan-id=10
add interface=bridge1 name=vlan20-cctv vlan-id=20
add interface=bridge1 name=vlan30-guest vlan-id=30
add interface=bridge1 name=vlan99-mgmt vlan-id=99
/ip address
add address=10.10.10.1/24 interface=vlan10-office
add address=10.10.20.1/24 interface=vlan20-cctv
add address=10.10.30.1/24 interface=vlan30-guest
add address=10.10.99.1/24 interface=vlan99-mgmtThe VLAN interfaces go on bridge1, not on a physical port. That's exactly where the old method went wrong.
5) Separate DHCP per VLAN
For example, the office VLAN:
/ip pool
add name=pool-office ranges=10.10.10.100-10.10.10.200
/ip dhcp-server
add name=dhcp-office interface=vlan10-office address-pool=pool-office
/ip dhcp-server network
add address=10.10.10.0/24 gateway=10.10.10.1 dns-server=10.10.10.1Repeat for VLAN 20 and 30 with their own addresses. If the router itself is the DNS server, allow-remote-requests has to be on, and the input firewall should only allow it from the inside, never from the WAN. (We covered that in the MikroTik security post.) For the management VLAN we usually skip DHCP and use static IPs.
6) Isolate VLANs with the firewall
The VLANs are separate now, but the router still routes between them. So a guest can still reach 10.10.10.x. Now the firewall decides who reaches what.
First, two interface lists:
/interface list
add name=WAN
add name=MGMT
/interface list member
add list=WAN interface=ether1
add list=MGMT interface=vlan99-mgmtThen the forward rules:
/ip firewall filter
add chain=forward action=accept connection-state=established,related comment="established/related"
add chain=forward action=drop connection-state=invalid comment="drop invalid"
add chain=forward action=accept in-interface=vlan10-office out-interface-list=WAN comment="office to internet"
add chain=forward action=accept in-interface=vlan30-guest out-interface-list=WAN comment="guest to internet"
add chain=forward action=accept in-interface-list=MGMT comment="mgmt to everything"
add chain=forward action=drop comment="drop everything else"What you get:
- Office and guest only get internet.
- Guests can't reach any internal VLAN.
- Cameras get no internet (lots of cameras phone home to outside servers for no good reason).
- Only the management VLAN can reach everything.
Careful: the last rule blocks any forwarded traffic not allowed above it. If you have a server or service that a VLAN needs to reach, add an accept for it before the last line. NAT (masquerade on the WAN) needs to be in place already.
7) Ingress filtering on ports
/interface bridge port
set [find interface=ether2] ingress-filtering=yes frame-types=admit-only-untagged-and-priority-tagged
set [find interface=ether3] ingress-filtering=yes frame-types=admit-only-untagged-and-priority-tagged
set [find interface=ether5] ingress-filtering=yes frame-types=admit-only-vlan-taggedAccess ports only accept untagged traffic, the trunk only accepts tagged. That way nobody can tag frames on their own PC and hop into another VLAN. MikroTik recommends using ingress-filtering wherever you can.
8) Filtering on the bridge itself
/interface bridge
set bridge1 frame-types=admit-only-vlan-tagged ingress-filtering=yesSince the bridge is a tagged member of every VLAN, the router's CPU doesn't need untagged traffic. This line stops accidental access through the default VLAN 1.
9) Turn on vlan-filtering
Now that everything is ready:
/interface bridge
set bridge1 vlan-filtering=yesThe bridge resets for a moment after this. If you're on ether8, you're fine.
Test
1) Check the VLAN table:
/interface bridge vlan printYou should see which ports are CURRENT-TAGGED and CURRENT-UNTAGGED for each VLAN. Make sure ether2 is only in VLAN 10 and ether3 only in 20. If there's a dynamic (D) entry for VLAN 1 with bridge1 untagged, you skipped step 8.
2) Ports and PVID:
/interface bridge port print detail3) DHCP:
Plug a laptop into ether2. It should get an IP from 10.10.10.100 up. You can see leases here:
/ip dhcp-server lease print4) Isolation test:
From a device on the guest VLAN, ping an office PC (for example 10.10.10.100). It shouldn't answer. A ping to an outside site should still work. Access to the router itself (like 10.10.10.1) is controlled by the input chain, not forward. We covered that in MikroTik hardening.
5) Firewall counters:
/ip firewall filter print statsAfter the test above, the counter on "drop everything else" should have gone up.
Tips
- Don't use VLAN 1 for anything. Every port has PVID=1 by default. Put your real networks on other numbers.
- Don't give the management VLAN to an access port. MikroTik itself says to allow management only through the trunk, since access ports are easier for strangers to reach.
- Lock Winbox and SSH to the management VLAN too. The MikroTik security post shows how, with
addresson the services and the input firewall. - Access points: make the AP's port a trunk and map each SSID to a VLAN on the AP itself, for example the guest SSID on VLAN 30.
- Naming: name interfaces like
vlan30-guest. Six months from now you or your teammate will thank you. - Every change in Safe Mode. Especially on the bridge VLAN table, one small mistake can take the whole network down.
FAQ
What's the difference between trunk and access ports on MikroTik?
An access port carries one VLAN, untagged, and connects to a PC or printer. A trunk port carries several VLANs, tagged, and connects to another switch or access point.
Does Bridge VLAN Filtering slow MikroTik down?
Not on models whose switch chip supports VLAN filtering (like CRS3xx), because the work is done in hardware. On other models the load goes to the CPU. Check the Hardware Offloading table first.
Why did I lose access after enabling vlan-filtering?
Usually because the bridge wasn't tagged on the management VLAN, or you were connected through a bridge port. Connect through a separate port or the console and turn on Safe Mode.
Can I use VLAN 1?
Better not. Every port has PVID=1 by default, so put your real networks on other IDs.
If you run a multi-branch network or lots of switches and want the VLAN layout and firewall designed properly, the ITcorv team can help through our network services and network security services. For a consultation, reach us on this page.