Networks

Office network segmentation on MikroTik: VLANs for staff, guests and servers

Why a flat network where every device sees every other one is the main source of trouble in a small office, and how to split it into VLANs on MikroTik with RouterOS 7: the layout, bridge configuration, firewall rules and common mistakes.

Alexei Sergeev 4 min read

Most small office networks look the same: one router, a couple of unmanaged switches and a single subnet for everyone. Accounting PCs, printers, cameras, the server, staff phones and the laptop of a visitor who asked for the Wi-Fi password all share one broadcast domain. While the office is small, this works. Then the oddities begin: the network slows down for no visible reason, and a single infected laptop can reach the shared folders on the server.

When I bring order to a network, I almost always start with segmentation. Below is how I do it on MikroTik equipment and what I pay attention to.

Why split the network into segments

Segmentation means dividing one large network into several logical ones, with traffic between them passing only through the router and only under explicit rules. Technically, segments are built with VLANs: one physical cable and one switch can carry several isolated networks.

  • Security. Guest devices and smart gadgets cannot see work computers or the server. If something gets infected, the problem stays inside its segment.
  • Predictability. Broadcast traffic does not spread across the whole office, and a faulty device does not take the entire network down.
  • Manageability. It is clear where everything is: a device's address tells you which group it belongs to, and access rules are written per segment rather than per IP.

A typical office layout

For an office with 10 to 100 workstations, four or five segments are usually enough. Choose the VLAN numbers and addressing once and write them down; it will save time for everyone who maintains the network later.

VLAN Segment Subnet Access
10 Staff 10.10.10.0/24 Internet, servers, printers
20 Servers 10.10.20.0/24 Only the required ports from the staff network
30 Printers, cameras, IoT 10.10.30.0/24 No internet access unless needed
40 Guests 10.10.40.0/24 Internet only
99 Equipment management 10.10.99.0/24 Administrator only
Sample addressing plan. Numbers and subnets are illustrative and are chosen for each office.

Configuration on MikroTik with RouterOS 7

Below is a simplified example for a router with a workstation and a guest access point connected directly, and a trunk carrying the other VLANs from a managed switch on port ether5. I use the modern approach, bridge VLAN filtering, which keeps switching in hardware on most models.

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

/interface bridge port
add bridge=bridge1 interface=ether2 pvid=10 comment="workstation"
add bridge=bridge1 interface=ether3 pvid=40 comment="guest access point"
add bridge=bridge1 interface=ether5 comment="trunk to switch"

/interface bridge vlan
add bridge=bridge1 vlan-ids=10 tagged=bridge1,ether5 untagged=ether2
add bridge=bridge1 vlan-ids=20,30,99 tagged=bridge1,ether5
add bridge=bridge1 vlan-ids=40 tagged=bridge1,ether5 untagged=ether3

/interface vlan
add interface=bridge1 name=vlan10-staff vlan-id=10
add interface=bridge1 name=vlan20-servers vlan-id=20
add interface=bridge1 name=vlan40-guests vlan-id=40

/ip address
add address=10.10.10.1/24 interface=vlan10-staff
add address=10.10.20.1/24 interface=vlan20-servers
add address=10.10.40.1/24 interface=vlan40-guests

# last step: enable filtering
/interface bridge set bridge1 vlan-filtering=yes

Next, each segment gets its own DHCP server (/ip dhcp-server setup on the VLAN interface), and the managed switch gets the same VLAN numbers on the trunk port and the access ports.

Firewall rules between segments

VLANs alone are not isolation: if the router forwards everything, the segments will talk to each other freely through it. So the next step is rules in the forward chain. I follow the principle that everything not explicitly allowed is denied, and start with a basic set:

firewall.rsc
/ip firewall filter
add chain=forward action=accept connection-state=established,related comment="replies to allowed connections"
add chain=forward action=drop connection-state=invalid
add chain=forward action=accept in-interface=vlan40-guests out-interface-list=WAN comment="guests: internet only"
add chain=forward action=drop in-interface=vlan40-guests comment="guests: everything else denied"
add chain=forward action=accept in-interface=vlan10-staff out-interface=vlan20-servers protocol=tcp dst-port=443,445 comment="staff -> servers: required ports"
add chain=forward action=drop in-interface=vlan20-servers out-interface=vlan10-staff connection-state=new comment="servers do not open connections to workstations"

The ports in the example are illustrative: in practice, the list is drawn up once it is clear which services are actually in use. It is a good occasion for an inventory, and it often turns out that half of what was opened just in case is not needed by anyone.

Common mistakes

  • VLAN filtering enabled without Safe Mode, and access to the router is lost. Then someone has to go to the office with a laptop and a cable.
  • The management network is forgotten, and equipment interfaces stay reachable from guest Wi-Fi.
  • An unmanaged switch in the middle of a trunk. Cheap switches sometimes pass tagged traffic and sometimes do not; the behaviour is unpredictable.
  • No documentation. Six months later nobody remembers which port is in which VLAN or why rule number 14 is there.

Where to start

If the network is already in use, there is no need to rebuild it live in one evening. My usual order is: an inventory of devices and a diagram of the current network, an addressing and segment plan, then moving guests and IoT first (this is safe and gives an immediate effect), then servers, then workstations. Every step can be rolled back.

More on what network work includes is on the Networks and network infrastructure page.

Need to bring order to your office network?

Describe how the network is set up now and what worries you. I will propose a segmentation plan and a migration order that does not stop work.

Discuss your task

Alexei SergeevEngineer, IT infrastructure and DevOps

Read next

Backup internet for the office: two ISPs and automatic failover on MikroTik

How to set up a second internet connection so the office switches to it automatically and back again when the main provider recovers. Recursive routing on MikroTik, reachability checks and the pitfalls.

Site-to-site VPN on MikroTik: WireGuard for branch offices and remote staff

How to connect two offices and remote employees with WireGuard on MikroTik running RouterOS 7: the addressing plan, tunnel and route configuration, firewall rules and what to test before handover.

Corporate Wi-Fi: why office coverage is poor and how to fix it

Dead zones, drops when walking between rooms and slowness in the meeting room: I go through the common causes of office Wi-Fi problems and how I design a wireless network so that it works reliably.