Skip to content
MikroTik RouterOS Docs

Switch Ports and VLAN Configuration

For the impatient: basic trunk and access port setup with VLANs.

# Create bridge (VLAN filtering disabled initially)
/interface/bridge/add name=bridge1 vlan-filtering=no
# Add trunk port (tagged VLANs)
/interface/bridge/port/add bridge=bridge1 interface=ether1 frame-types=admit-only-vlan-tagged
# Add access ports (untagged, with PVID)
/interface/bridge/port/add bridge=bridge1 interface=ether2 pvid=10
/interface/bridge/port/add bridge=bridge1 interface=ether3 pvid=20
# Configure VLAN table
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1 untagged=ether2 vlan-ids=10
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1 untagged=ether3 vlan-ids=20
# Enable VLAN filtering (do this last!)
/interface/bridge/set bridge1 vlan-filtering=yes

Verify with:

/interface/bridge/port/print
# Look for "H" flag indicating hardware offloading

What this does: Configures switch ports for VLAN segmentation, allowing you to separate traffic into virtual networks on the same physical infrastructure. MikroTik offers two approaches: bridge VLAN filtering (recommended) and direct switch chip configuration (legacy).

When to use this:

  • Separating network segments (guest, IoT, management, etc.)
  • Connecting to other switches via trunk ports
  • Implementing access ports for end devices
  • Optimizing performance with hardware offloading

Prerequisites:

  • Bridge interface created
  • Understanding of VLAN concepts (tagged vs untagged)
  • Physical ports not already in use by another bridge

Two Configuration Approaches

Bridge VLAN Filtering (Recommended): Unified interface across all devices, hardware offloading where supported.

Switch Chip Configuration (Legacy): Direct hardware access, device-specific, maximum control on supported chips.

This guide focuses on bridge VLAN filtering. See the Reference section for switch chip commands.

Step 1: Create Bridge (VLAN Filtering Disabled)

Section titled “Step 1: Create Bridge (VLAN Filtering Disabled)”

Always start with VLAN filtering disabled to avoid losing management access:

/interface/bridge/add name=bridge1 vlan-filtering=no

Trunk ports carry multiple VLANs with tags. Configure to accept only tagged frames:

/interface/bridge/port/add bridge=bridge1 interface=ether1 frame-types=admit-only-vlan-tagged

Access ports connect end devices. Set the PVID (Port VLAN ID) for each:

# VLAN 10 for office devices
/interface/bridge/port/add bridge=bridge1 interface=ether2 pvid=10 \
frame-types=admit-only-untagged-and-priority-tagged
# VLAN 20 for guest devices
/interface/bridge/port/add bridge=bridge1 interface=ether3 pvid=20 \
frame-types=admit-only-untagged-and-priority-tagged

Define which ports belong to which VLANs:

# VLAN 10: trunk (tagged) + ether2 (untagged)
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1 untagged=ether2 vlan-ids=10
# VLAN 20: trunk (tagged) + ether3 (untagged)
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1 untagged=ether3 vlan-ids=20

Critical: Only enable after all configuration is complete:

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

Check that ports show hardware offloading:

/interface/bridge/port/print

Expected output:

Flags: I - INACTIVE; H - HW-OFFLOAD
# INTERFACE BRIDGE HW PVID PRIORITY PATH-COST HORIZON
0 H ether1 bridge1 yes 1 0x80 10 none
1 H ether2 bridge1 yes 10 0x80 10 none
2 H ether3 bridge1 yes 20 0x80 10 none

The “H” flag indicates hardware offloading is active.

Allow router management through a dedicated VLAN:

# Add management VLAN with bridge as tagged member
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1,bridge1 vlan-ids=99
# Create VLAN interface for management
/interface/vlan/add interface=bridge1 name=vlan99-mgmt vlan-id=99
# Assign IP address
/ip/address/add address=192.168.99.1/24 interface=vlan99-mgmt

Order Matters

Configure management VLAN and IP address before enabling vlan-filtering=yes, or you will lose access to the router.

Add several VLANs to a trunk connection:

# Add multiple VLANs at once
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1,ether8 vlan-ids=10,20,30,99

A port that sends one VLAN untagged and others tagged (common for VoIP phones with PC passthrough):

# Port carries VLAN 10 untagged (for PC) and VLAN 100 tagged (for phone)
/interface/bridge/port/add bridge=bridge1 interface=ether4 pvid=10 frame-types=admit-all
/interface/bridge/vlan/add bridge=bridge1 untagged=ether4 vlan-ids=10
/interface/bridge/vlan/add bridge=bridge1 tagged=ether1,ether4 vlan-ids=100

Scenario: Enable Ingress Filtering (Security)

Section titled “Scenario: Enable Ingress Filtering (Security)”

Block traffic from unauthorized VLANs:

/interface/bridge/port/set [find bridge=bridge1] ingress-filtering=yes

Route between VLANs on the router:

# Create VLAN interfaces
/interface/vlan/add interface=bridge1 name=vlan10 vlan-id=10
/interface/vlan/add interface=bridge1 name=vlan20 vlan-id=20
# Assign IP addresses (act as gateway for each VLAN)
/ip/address/add address=192.168.10.1/24 interface=vlan10
/ip/address/add address=192.168.20.1/24 interface=vlan20
# Routing happens automatically between directly connected networks

Limit broadcast/multicast flooding to prevent storms:

/interface/ethernet/switch/port/set ether1 storm-rate=1 \
limit-broadcasts=yes limit-unknown-unicasts=yes limit-unknown-multicasts=yes

Note: storm-rate is a percentage. On a 1Gbps port, 1% = 10Mbps minimum.

Mirror traffic from one port to a monitoring port:

# Hardware mirroring (switch chip)
/interface/ethernet/switch/set switch1 mirror-source=ether2 mirror-target=ether5
# Or software mirroring (bridge)
/interface/bridge/set bridge1 mirror-source=ether2 mirror-target=ether5

Limit bandwidth on a specific port:

# Hardware rate limiting (if supported)
/interface/ethernet/switch/port/set ether2 ingress-rate=100000000 egress-rate=50000000
# Software rate limiting (works on all devices)
/queue/simple/add name=ether2-limit target=ether2 max-limit=100M/50M

Confirm your switch port configuration is working:

Check 1: Verify Bridge Ports and Offloading

Section titled “Check 1: Verify Bridge Ports and Offloading”
/interface/bridge/port/print

Expected: Ports listed with “H” flag for hardware offloading.

/interface/bridge/vlan/print

Expected: VLANs with correct tagged/untagged port assignments.

/interface/bridge/port/monitor [find interface=ether1]

Expected: status: in-bridge, forwarding: yes.

/interface/bridge/host/print

Expected: MAC addresses learned on correct ports/VLANs.

/interface/ethernet/switch/print

Shows available hardware features for your device.

SymptomCauseSolution
No “H” flag on bridge portsDevice doesn’t support HW offload, or config incompatibleCheck switch chip capabilities; verify configuration
Lost management access after enabling VLAN filteringManagement traffic filteredConfigure management VLAN before enabling filtering
VLANs not working between portsPorts on different switch chipsInclude bridge as tagged member of all cross-chip VLANs
VLAN interface on bridge port doesn’t workBridge captures traffic before VLANCreate VLAN interfaces on bridge, not slave ports
Unexpected VLAN membershipPVID auto-adds untagged membershipUse frame-types=admit-only-vlan-tagged on trunks
Unauthorized VLAN traffic passingIngress filtering disabledEnable ingress-filtering=yes on ports
LLDP/802.1X/LACP not workingSTP filtering reserved addressesSet protocol-mode=none on bridge if no loops
High CPU with switch trafficHardware offloading not workingVerify “H” flag; check chip compatibility

Some devices (RB4011, RB5009) have multiple switch chips. Traffic between ports on different chips goes through CPU.

Solution: Include the bridge as a tagged member for any VLAN that needs to cross chips:

/interface/bridge/vlan/add bridge=bridge1 tagged=ether1,ether10,bridge1 vlan-ids=10
/interface/bridge/port/print detail

Ports in the same hw-offload-group can communicate at wire speed.

Common Mistakes

  • Enabling VLAN filtering before configuring management access - Always set up management VLAN first
  • Creating VLAN interfaces on slave ports - Must be on the bridge interface, not individual ports
  • Forgetting frame-types on trunk ports - PVID will auto-add port as untagged to VLAN 1
  • Assuming hardware offloading works - Always verify with “H” flag in port list
  • Mixing bridge and switch chip VLAN config - Use one approach, not both
  • Not enabling ingress filtering - Unauthorized VLAN traffic may still pass
Device/ChipBridge VLANStorm ControlRate LimitNotes
CRS3xx/CRS5xxYes (HW)YesYesFull L2/L3 offload
CRS1xx/CRS2xxLimitedNoLimitedOlder chips
RB4011Yes (2 chips)NoNoCross-chip = CPU
RB5009Yes (2 chips)NoNoCross-chip = CPU
hEX/hAP (MT7621)Yes (v7+)NoNoGood HW offload in v7
CCR/CHRYes (CPU)NoNoSoftware only

Bridge Port Properties (/interface/bridge/port)

Section titled “Bridge Port Properties (/interface/bridge/port)”
PropertyTypeDefaultDescription
bridgestring-Bridge interface name (required)
interfacestring-Physical interface (required)
pvidinteger1Port VLAN ID for untagged traffic (1-4094)
frame-typesenumadmit-allIngress frame filtering
ingress-filteringyes/nonoDrop packets from disallowed VLANs
hwyes/noyesEnable hardware offloading
trustedyes/nonoDHCP snooping trusted port
edgeenumautoEdge port for (R)STP
bpdu-guardyes/nonoDisable port on BPDU receive
horizonintegernoneSplit-horizon group
broadcast-floodyes/noyesAllow broadcast flooding
unknown-unicast-floodyes/noyesAllow unknown unicast flooding
ValueUse Case
admit-allDefault, accepts all frames
admit-only-untagged-and-priority-taggedAccess port
admit-only-vlan-taggedTrunk port

Bridge VLAN Properties (/interface/bridge/vlan)

Section titled “Bridge VLAN Properties (/interface/bridge/vlan)”
PropertyTypeDefaultDescription
bridgestring-Bridge interface (required)
vlan-idsinteger/range-VLAN ID(s) 1-4094 (required)
taggedinterface list-Ports sending tagged frames
untaggedinterface list-Ports stripping VLAN tags

Switch Port Properties (/interface/ethernet/switch/port)

Section titled “Switch Port Properties (/interface/ethernet/switch/port)”
PropertyTypeDefaultDescription
vlan-modeenumfallbackVLAN table checking mode
vlan-headerenumleave-as-isEgress VLAN tag handling
default-vlan-idinteger1Default VLAN for untagged
storm-rateinteger100Storm control threshold (%)
ingress-rateinteger0Ingress rate limit (bps)
egress-rateinteger0Egress rate limit (bps)
mirroryes/nonoEnable port mirroring
ValueBehavior
disabledIgnore VLAN table
fallbackCheck table for tagged frames only
checkRequire untagged match default-vlan-id
secureStrictest validation