Basic VLAN Configuration
Basic VLAN Configuration
Section titled âBasic VLAN ConfigurationâTL;DR (Quick Start)
Section titled âTL;DR (Quick Start)âFor the impatient: hereâs the 30-second version.
# Create VLANs on trunk interface/interface vlan add name=vlan100 vlan-id=100 interface=ether2/interface vlan add name=vlan200 vlan-id=200 interface=ether2/ip address add address=10.100.0.1/24 interface=vlan100/ip address add address=10.200.0.1/24 interface=vlan200Overview
Section titled âOverviewâThis guide demonstrates how to configure VLANs on MikroTik RouterOS using VLAN interfaces on top of a physical interface.
Prerequisites
Section titled âPrerequisitesâ- A MikroTik router running RouterOS 7.x or later
- Access to the router via SSH, WinBox, or WebFig
Configuration Steps
Section titled âConfiguration StepsâStep 1: Create VLAN 100 Interface
Section titled âStep 1: Create VLAN 100 InterfaceâCreate a VLAN interface with ID 100 on ether2:
/interface vlan add name=vlan100 vlan-id=100 interface=ether2 comment="Management VLAN"Step 2: Create VLAN 200 Interface
Section titled âStep 2: Create VLAN 200 InterfaceâCreate a second VLAN for guest network:
/interface vlan add name=vlan200 vlan-id=200 interface=ether2 comment="Guest VLAN"Step 3: Assign IP to VLAN 100
Section titled âStep 3: Assign IP to VLAN 100âConfigure an IP address on the management VLAN:
/ip address add address=10.100.0.1/24 interface=vlan100 comment="VLAN 100 Gateway"Step 4: Assign IP to VLAN 200
Section titled âStep 4: Assign IP to VLAN 200âConfigure an IP address on the guest VLAN:
/ip address add address=10.200.0.1/24 interface=vlan200 comment="VLAN 200 Gateway"Verification
Section titled âVerificationâCheck 1: VLAN Interfaces
Section titled âCheck 1: VLAN Interfacesâ/interface vlan printExpected Output:
Flags: X - disabled, R - running # NAME MTU ARP VLAN-ID INTERFACE 0 R vlan100 1500 enabled 100 ether2 1 R vlan200 1500 enabled 200 ether2Check 2: VLAN IP Addresses
Section titled âCheck 2: VLAN IP Addressesâ/ip address print where interface~"vlan"Expected Output:
Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK INTERFACE 0 10.100.0.1/24 10.100.0.0 vlan100 1 10.200.0.1/24 10.200.0.0 vlan200Troubleshooting
Section titled âTroubleshootingâProblem: VLAN traffic not passing
Section titled âProblem: VLAN traffic not passingâSymptoms: Devices in VLAN cannot communicate, no connectivity.
Causes & Solutions:
-
Switch port not configured as trunk - The connected switch must tag traffic:
- Configure switch port as trunk/tagged for VLANs 100, 200
- Verify with packet capture that tagged frames are being sent
-
Wrong VLAN ID - Verify VLAN IDs match on both ends:
/interface vlan print -
Parent interface down - Check the physical interface:
/interface print where name=ether2
Problem: VLAN interface not running
Section titled âProblem: VLAN interface not runningâSymptoms: VLAN interface shows without âRâ (running) flag.
Causes & Solutions:
-
Parent interface is down - Bring up the parent interface:
/interface enable ether2 -
VLAN disabled - Enable the VLAN interface:
/interface vlan enable vlan100
Problem: Inter-VLAN routing not working
Section titled âProblem: Inter-VLAN routing not workingâSymptoms: Devices in different VLANs cannot reach each other.
Causes & Solutions:
-
IP forwarding disabled - Verify routing is enabled (it is by default)
-
Firewall blocking traffic - Check forward chain:
/ip firewall filter print chain=forward -
Devices have wrong gateway - Ensure devices point to the correct VLAN gateway IP
Problem: Only one VLAN works
Section titled âProblem: Only one VLAN worksâSymptoms: One VLAN has connectivity, others donât.
Causes & Solutions:
- Native VLAN mismatch - Check if traffic is being sent untagged:
Verify the switch native VLAN configuration matches/interface vlan print detail
Related Topics
Section titled âRelated TopicsâPrerequisites
Section titled âPrerequisitesâ- Bridge Configuration - VLANs often run on top of bridges
Next Steps
Section titled âNext Stepsâ- IP Address Configuration - assign gateway IPs to VLAN interfaces
- DHCP Server - provide IP addresses per VLAN
- DHCP Relay - centralized DHCP across multiple VLANs
- Firewall Basics - control inter-VLAN traffic
Advanced Topics
Section titled âAdvanced Topicsâ- Bridge VLAN Filtering - hardware-offloaded VLAN handling
- VLAN Fundamentals - in-depth VLAN concepts