DEV Community

Cover image for Mastering MikroTik & Managed Switches: Routing, VLANs, PPPoE, Failover, QoS & Security
J M C Dias
J M C Dias

Posted on • Edited on

Mastering MikroTik & Managed Switches: Routing, VLANs, PPPoE, Failover, QoS & Security

πŸ“˜ Complete Guide: MikroTik in Practice β€” VLANs, PPPoE, Failover, NAT, Mangle, QoS & Firewall

This guide is the result of in-depth, real-world study in networking using MikroTik and Cisco managed switches.

It covers everything from the OSI model to real configurations β€” including VLANs, PPPoE, routing marks, NAT, firewalling, automatic failover, and Queue Tree QoS.

If you're aiming to level up your networking skills for professional environments, this is a hands-on starting point.

🧠 This article is part of my upcoming eBook:

πŸ› οΈ The Practical Network Blueprint: Real Infrastructure with MikroTik, Cisco & Cloud Edge

A complete and evolving resource that compiles content from all my technical posts into one cohesive reference.


πŸ“˜ Module 1 β€” Networking Fundamentals: Layers, Switches & Routers

🧠 OSI Model Explained with Real-Life Analogy

The OSI model breaks network communication into 7 logical layers.

Think of it like sending a letter:

  • Layer 1: Physical β†’ The envelope being passed hand-to-hand β†’ Cables, signals
  • Layer 2: Data Link β†’ Sender/receiver address β†’ MAC address, Switches
  • Layer 3: Network β†’ ZIP/Postal code β†’ IP, Routing
  • Layer 4: Transport β†’ Type of delivery (express, registered) β†’ TCP, UDP
  • Layers 5–7: Session–Application β†’ The letter content β†’ Browser, Email, WinBox

πŸ”Ž In daily usage:

  • Layer 2 β†’ Plugging a cable into a switch
  • Layer 3 β†’ MikroTik routing packets by IP
  • Layer 4 β†’ Browser initiating a TCP connection

πŸ”Ή How This Applies to MikroTik

When configuring VLANs, PPPoE, NAT, or mangle rules, you're working across:

  • Layer 2 β†’ VLANs, MAC addresses
  • Layer 3 β†’ IP addresses and routing
  • Layer 4+ β†’ Ports like 80, 443, etc.

πŸ–§ Switches and VLANs (Layer 2)

🎯 What is a VLAN?

A VLAN (Virtual LAN) is a logically isolated network on the same physical switch.

Example – A 24-port switch:

  • Ports 1–8 β†’ VLAN 10 (Admin)
  • Ports 9–16 β†’ VLAN 20 (Finance)
  • Ports 17–24 β†’ VLAN 30 (Guests)

πŸ’‘ Devices in different VLANs cannot communicate unless routed.


πŸ”€ Tagged vs Untagged Traffic

Type Where Meaning
Tagged Trunk port Packet includes VLAN ID
Untagged Access port Packet already assigned VLAN

πŸ”„ Access vs Trunk Ports

  • Access port β†’ Connects to end devices (PCs, printers). One VLAN.
  • Trunk port β†’ Connects to MikroTik or other switches. Multiple VLANs (tagged).

πŸ§ͺ Topology Example (Cisco Switch + MikroTik)


\[Fiber ISP]
|
Cisco Switch (Gi1/1/2 β€” trunk)
|
MikroTik (ether13)
|
VLAN 13 β†’ Link C
VLAN 10 β†’ Link A
VLAN 20 β†’ Internal LAN

Enter fullscreen mode Exit fullscreen mode

πŸ”§ Cisco Switch Configuration

vlan 10
 name LINK_A
vlan 13
 name LINK_C
vlan 20
 name LAN_LOCAL

interface Gi1/1/2
 description Trunk to MikroTik
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 10,13,20
Enter fullscreen mode Exit fullscreen mode

πŸ“˜ How MikroTik Sees This

MikroTik uses virtual VLAN interfaces over physical ports.

/interface vlan
add name=vlan13 vlan-id=13 interface=ether13 comment="LINK C"

/ip address
add address=192.0.2.2/30 interface=vlan13
Enter fullscreen mode Exit fullscreen mode

πŸ“Œ Use Case β€” Isolating Departments

  • VLAN 100 β†’ Management
  • VLAN 200 β†’ Finance
  • VLAN 300 β†’ Guest Wi-Fi
  • VLAN 400 β†’ IP Cameras

Use MikroTik firewall rules to allow or deny communication between them.


🧠 Module Summary

  • VLAN β†’ Logical network segmentation
  • Trunk β†’ Port carrying multiple VLANs
  • Access β†’ Port for end-user device (1 VLAN)
  • Tagged β†’ Packet includes VLAN ID
  • Untagged β†’ Already assigned to VLAN

πŸ“˜ Module 2 β€” Creating VLANs on Cisco Switch + MikroTik

🧠 Real Scenario

You’ve added a new internet link (Link C) via Ethernet to your Cisco switch.
You must deliver this link to MikroTik using VLAN 13.

You’ll need to:

  • Create VLAN 13 on Cisco
  • Allow it on the trunk port to MikroTik
  • Create VLAN interface in MikroTik
  • Assign public IP and routing

🎯 Setup Summary

Device Task
Cisco Switch Create VLAN, allow on trunk
MikroTik Create /interface vlan, IP

πŸ§ͺ Example Setup

  • VLAN ID: 13
  • Switch Port: Gi1/1/2
  • MikroTik Port: ether13
  • Public IP: 192.0.2.2/30
  • Gateway: 192.0.2.1

πŸ”§ Cisco Configuration

conf t
vlan 13
 name LINK_C
exit

interface Gi1/1/2
 description Trunk to MikroTik
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan add 13
 switchport mode trunk
exit
Enter fullscreen mode Exit fullscreen mode

⚠️ Make sure the port is set to trunk mode.


🌐 MikroTik VLAN Configuration

/interface vlan
add name=vlan13 vlan-id=13 interface=ether13 comment="LINK C - VLAN 13"

/ip address
add address=192.0.2.2/30 interface=vlan13 comment="Public IP - LINK C"
Enter fullscreen mode Exit fullscreen mode

βœ… MikroTik now sees VLAN 13 as a normal interface.


πŸ“ˆ Connectivity Test (in MikroTik)

ping 192.0.2.1
Enter fullscreen mode Exit fullscreen mode

βœ… If it replies, the VLAN and trunk are working correctly.


πŸ’‘ Use Clear Naming

Interface Description
vlan10 Link A (VLAN 10)
vlan13 Link C (VLAN 13)
vlan20 Internal LAN

⚠️ Common Problems & Fixes

Symptom Likely Cause Solution
No ping to gateway VLAN not in trunk Check switchport trunk allowed
No MikroTik traffic Wrong VLAN ID/port Confirm VLAN + physical port
No public IP PPPoE required See Module 3 for config

🧠 Module Summary

  • Create VLANs on the switch
  • Allow them on trunk ports
  • Use /interface vlan on MikroTik
  • Assign IPs as if physical interface
  • Use ping to test connectivity
  • Use clear naming conventions

πŸ”— What’s Next?

This is just the beginning. Modules 3–7 cover:

  • PPPoE
  • Routing marks
  • NAT & Mangle
  • QoS
  • Firewall security
  • Real-world failover diagnostics

πŸ‘‰ Continue the full 7-module series on Medium

Top comments (0)