Originally published at woitzik.dev
Disclosure: This post contains Amazon affiliate links (marked with *). If you buy through them, I earn a small commission at no extra cost to you. I only link gear I actually own and use daily.
View the complete homelab infrastructure source on GitHub ๐
This is the networking debate that never dies in homelab circles: MikroTik or Ubiquiti? I have run both in production โ MikroTik RB5009 as my primary router for over two years with every firewall rule and VLAN managed via Terraform, and Ubiquiti UniFi gear in a friend's lab where I helped with deployment. This is not a spec-sheet comparison. It is a practical breakdown of what each platform actually delivers for a homelab that runs Proxmox, K3s, and zero-trust networking.
TL;DR โ The Verdict
MikroTik RB5009 if you want maximum control, Terraform-native automation, and the best price-to-performance in router hardware. The learning curve is steep, but the ceiling is infinitely higher.
Ubiquiti UniFi Dream Router if you want plug-and-play setup, a polished UI, and an ecosystem where access points, switches, and cameras all manage from one dashboard. You pay a premium and give up depth of control.
The short version: MikroTik is for engineers who want to own their network stack. Ubiquiti is for users who want a network that works without deep networking knowledge. Both are valid โ but for a homelab running infrastructure-as-code, MikroTik wins decisively.
Quick Comparison
| Feature | MikroTik RB5009 | Ubiquiti UniFi Dream Router |
|---|---|---|
| Price | ~โฌ180* | ~โฌ300* |
| CPU | Marvell 98DX3236 (ARM) | Quad-core ARM Cortex-A57 |
| RAM | 1GB | 2GB |
| Ports | 7x GbE + 1x 10G SFP+ | 4x GbE + 1x 2.5GbE WAN |
| Switch Chip | Yes (hardware offloading) | Integrated (software) |
| OS | RouterOS 7 | UniFi Network |
| Management | CLI, WinBox, API, Terraform | UniFi Controller (UI) |
| VLAN Support | Full (bridge VLAN filtering) | Full (VLAN networks) |
| VPN | WireGuard, OpenVPN, IPsec, PPTP | WireGuard, OpenVPN, L2TP |
| Wi-Fi | None (bring your own AP) | Built-in Wi-Fi 6 |
| Price/Performance | Excellent | Moderate |
Category-by-Category Breakdown
Design & Build Quality
The RB5009 is an industrial-looking metal box. No Wi-Fi, no antennas, no RGB. It has 7 Gigabit Ethernet ports, one 10G SFP+ cage, and a USB 3.0 port. The metal chassis dissipates heat passively โ no fan, no noise. It is designed to live in a rack or on a shelf without anyone noticing it. At 100x155x33mm, it is compact enough to mount in a 10-inch rack (I use a DIGITUS 10" rack* for mine).
The UniFi Dream Router (UDR) is designed to be seen. It is a white, cylindrical unit with a built-in Wi-Fi 6 access point and a small LED status ring. It looks like something from a modern living room, not a server closet. The build quality is good โ solid plastic, well-ventilated โ but it is designed for desk or shelf placement, not rack mounting. The form factor says "consumer product" while the RB5009 says "networking equipment."
Winner: MikroTik RB5009 for homelab use. The fanless design, rack-friendly form factor, and 10G SFP+ port make it the better infrastructure component. The UDR wins for living room aesthetics if that matters to you.
Features & Flexibility
This is where the gap becomes a canyon.
RouterOS 7 on the RB5009 is, functionally, a full Linux networking stack exposed through a proprietary CLI and API. You get: bridging with VLAN filtering, firewall with stateful packet inspection, NAT (source and destination), QoS (HTSQ, PCQ, CAKE), MPLS, BGP, OSPF, VPLS, bonding, MLAG, traffic shaping, bandwidth limiting, DHCP server with static bindings, DNS forwarding with split-horizon, CAPsMAN (centralized AP management), and more. The feature set is closer to enterprise networking gear (Cisco, Juniper) than to consumer routers.
The UDR runs UniFi Network, which is a software-defined networking platform. It provides: VLAN segmentation, firewall rules, IDS/IPS (Intrusion Detection/Prevention), traffic identification, guest portal, and DPI (Deep Packet Inspection). The UniFi Controller โ a web application that runs either on the UDR itself or on a separate server โ manages all of it through a graphical interface.
The UniFi feature set is impressive for what it is, but it is fundamentally a curated subset. You get the features Ubiquiti decided to implement, configured the way Ubiquiti decided to configure them. MikroTik gives you the entire toolbox and lets you build whatever you want. For a homelab that runs Terraform-managed infrastructure, the difference is critical โ MikroTik's API and CLI let you automate everything; UniFi's API is limited and unofficial.
Winner: MikroTik RB5009 for depth and automation potential. UniFi UDR for breadth of managed features out of the box (IDS/IPS, DPI, traffic identification).
Ease of Use
Ubiquiti wins this category flatly, and it is not close.
The UniFi Controller provides a visual dashboard showing network topology, connected clients, traffic flows, and security events. VLAN creation is a form fill. Firewall rules are a guided wizard. Firmware updates are one-click. If you have never configured a router before, the UDR will have your network segmented and secured in under 30 minutes.
RouterOS is a different world. The WinBox GUI exists and works, but it mirrors the CLI structure โ you navigate menus organized by protocol and feature, not by task. Creating a VLAN involves: creating a bridge, adding ports to the bridge, creating VLAN entries on the bridge, creating an interface for the VLAN, assigning an IP address, creating a DHCP server, and creating firewall rules for the new network. Each step is a separate resource. The CLI (or Terraform) makes this repeatable; the GUI makes it tedious.
I will not sugarcoat it: RouterOS has a steeper learning curve than any consumer router OS. The first time you configure Bridge VLAN Filtering, you will lock yourself out. The second time, you will not. By the third time, you will understand L2 networking better than 99% of home network users. That knowledge has value beyond MikroTik โ it transfers to every networking platform.
Winner: Ubiquiti UDR for initial setup and ongoing management. MikroTik for users who want to actually understand their network.
Security & Firewall
Both platforms support stateful packet inspection, NAT, and rule-based firewalling. The differences are in philosophy and depth.
MikroTik gives you full control over every firewall rule. The RouterOS firewall is a chain-based system (input, forward, output) with rule ordering that matters. You can filter by source/destination IP, port, protocol, connection state, interface, VLAN, packet content, and more. The zero-trust approach I documented in MikroTik Zero Trust Firewall with Terraform is built entirely on this: default-drop on input and forward, with explicit allow rules for each service.
Here is the actual Terraform code that creates the final drop rule in my firewall:
resource "routeros_ip_firewall_filter" "fwd_99_drop_all" {
action = "drop"
chain = "forward"
comment = "99: Global - Final Drop (Zero Trust Policy)"
}
That single rule, placed last in the chain, enforces zero trust for all forwarded traffic. Every allowed service must have an explicit rule before it. The simplicity is deceptive โ the complexity is in the rules above it, but the principle is clear: deny everything, allow by exception.
Ubiquiti offers IDS/IPS as a built-in feature, which MikroTik does not have natively. The UniFi IDS/IPS inspects traffic for known attack signatures and can automatically block or alert on suspicious activity. For a home network, this provides a layer of protection that a MikroTik firewall alone does not โ unless you add Suricata or Snort as a separate IDS on a mirror port.
The tradeoff: UniFi's IDS/IPS is a black box. You cannot customize the signatures, you cannot tune the sensitivity beyond broad categories, and you cannot export the logs to a SIEM easily. MikroTik's firewall is transparent โ every rule is visible, every log entry is configurable, and you can pipe logs to an external syslog server or Loki stack for analysis.
Winner: Tie. MikroTik wins for transparent, automatable, zero-trust firewall rules. UniFi wins for built-in IDS/IPS that requires zero configuration. The ideal setup uses both โ MikroTik as the router/firewall, UniFi APs for wireless, and an external IDS like Suricata for deep packet inspection.
VPN
Both platforms support WireGuard and OpenVPN. The implementation differences matter.
MikroTik RB5009 runs WireGuard natively in RouterOS 7. The WireGuard implementation supports multiple peers, fine-grained allowed IPs, and persistent keepalive โ everything you need for site-to-site or remote access VPN. I run WireGuard on my RB5009 for remote access to the homelab, and the Terraform code for it is in the repo:
resource "routeros_interface_wireguard" "wg0" {
listen_port = 13231
name = "wg0"
}
MikroTik also supports IPsec (IKEv1 and IKEv2) for site-to-site VPN with other vendors, OpenVPN for legacy client access, and PPTP (which you should never use). The RB5009's CPU handles WireGuard encryption in software โ it maxes out around 1.5-2Gbps throughput, which is more than enough for a home WAN link.
UniFi UDR supports WireGuard and OpenVPN through the controller interface. Setup is simpler โ a few form fills and you have a VPN tunnel. The UDR also supports Teleport (Ubiquiti's proprietary VPN) which uses WireGuard under the hood but with a simplified peer exchange mechanism.
The limitation: UniFi's VPN integration is shallow. You cannot fine-tune WireGuard parameters (MTU, pre-shared keys, handshake intervals) the way you can on MikroTik. Site-to-site VPN between UniFi and non-UniFi devices is possible but not well-documented. For a homelab that needs VPN access to specific VLANs or subnets, MikroTik's granular control is essential.
Winner: MikroTik RB5009 for VPN flexibility and fine-grained control. UniFi wins for quick-and-easy remote access setup.
VLAN Support
Both platforms support VLAN tagging, trunk ports, and access ports. The implementation approach is fundamentally different.
MikroTik handles VLANs through Bridge VLAN Filtering on a single bridge. All physical ports join one bridge, and VLANs are defined as entries in the bridge's VLAN table. This approach enables hardware offloading on the RB5009's switch chip โ tagged traffic is switched in hardware, not software. The result: full wire-speed VLAN performance even with dozens of VLANs configured.
The Terraform code for my entire VLAN matrix โ five VLANs, trunk ports, access ports, IP addresses, and DHCP servers โ is about 100 lines of HCL. Add a new VLAN? Change one map and run terraform apply.
UniFi handles VLANs by creating "VLAN Networks" in the controller. Each VLAN is a separate network object with its own subnet, DHCP scope, and firewall rules. Trunk ports are configured per-switch-port in the UI. The approach is intuitive โ each VLAN is a first-class object in the UI โ but it ties you to the UniFi Controller for management.
Both approaches work well. MikroTik's is more flexible and automatable. UniFi's is more visual and self-documenting. For a homelab that needs VLANs for network segmentation (management, server, DMZ, IoT, admin), both platforms handle it without issue.
Winner: Tie. MikroTik for automation and hardware offloading. UniFi for visual management and simplicity.
Terraform & Automation Support
This is where MikroTik pulls away decisively for any homelab running infrastructure-as-code.
The MikroTik Terraform Provider (routeros) is mature, well-maintained, and covers nearly every RouterOS resource: interfaces, bridges, VLANs, firewall rules, DHCP, DNS, WireGuard, routing, and more. You can define your entire network stack in HCL, version it in Git, and apply changes through a CI pipeline or Atlantis. This is exactly how I manage my homelab โ every MikroTik configuration change goes through a PR, gets reviewed, and is applied via Atlantis.
The Ubiquiti Terraform Provider (ubiquiti) is unofficial and limited. The community provider (paultyng/ubiquiti) covers basic device management but does not support network configuration, VLAN creation, or firewall rules through Terraform. There is no official UniFi Terraform provider from Ubiquiti. This means every network configuration change on UniFi must go through the controller UI โ there is no IaC path.
For a homelab that already uses Terraform for Proxmox VMs, MikroTik firewall rules, and Kubernetes resources, the lack of UniFi Terraform support is a dealbreaker. You would end up with two configuration workflows: Terraform for everything except the network, and manual UI clicks for the network. That is exactly the kind of configuration drift that IaC is designed to prevent.
Winner: MikroTik RB5009 โ decisively. No meaningful competition in this category.
Ecosystem & Expandability
Ubiquiti wins on ecosystem breadth. The UniFi ecosystem includes switches, access points, cameras (Protect), phones (Talk), displays (Connect), and a centralized controller that manages all of it. If you want one vendor for your entire network stack โ router, switches, APs, cameras โ UniFi provides that experience. The ecosystem lock-in is real, but so is the integration quality.
MikroTik has a broader product line than most people realize โ routers, switches, access points, antennas, and even outdoor wireless gear. CAPsMAN (Centralized Access Point Manager) lets you manage MikroTik APs from the router itself. But the ecosystem is not as tightly integrated as UniFi. Each device runs RouterOS independently; there is no single controller dashboard (The Dude exists but is not comparable to the UniFi Controller).
For a homelab that primarily needs a router and a few switches, MikroTik's ecosystem is sufficient. For a whole-home networking deployment with cameras, multiple APs, and managed switches, UniFi's ecosystem provides a more cohesive experience.
Winner: Ubiquiti UDR for integrated ecosystem. MikroTik for standalone router/switch deployments.
Price & Value
The RB5009 costs roughly โฌ180. The UniFi Dream Router costs roughly โฌ300. That โฌ120 difference buys you: built-in Wi-Fi 6 on the UDR (MikroTik requires a separate AP, ~โฌ50-100 for a hAP ac3 or cAP ax), the UniFi Controller software, and IDS/IPS.
If you add a MikroTik AP to the RB5009 (which you will need if you want Wi-Fi), the total cost approaches the UDR. But you get a significantly more powerful router and a separate, dedicated AP โ which is arguably better than a combined router/AP unit that must serve both roles.
For a homelab that does not need Wi-Fi from the router (most homelabs have a separate AP or run wired-only), the RB5009 at โฌ180 is the clear value winner. For a whole-home setup where one device handles routing and Wi-Fi, the UDR's combined value is harder to beat.
Winner: MikroTik RB5009 for homelab use. UDR for whole-home Wi-Fi + routing in one device.
Who Should Buy Which
Buy the MikroTik RB5009 if:
- You run Terraform for infrastructure management and want network automation
- You want zero-trust firewall rules with full control over every packet
- You value learning networking over having it pre-configured
- You do not need Wi-Fi from the router itself
- Budget matters โ โฌ180 buys enterprise-grade routing
Buy the UniFi Dream Router if:
- You want plug-and-play setup with a polished UI
- You need built-in Wi-Fi 6 without a separate AP
- You want IDS/IPS without deploying a separate appliance
- You are building a whole-home UniFi ecosystem (switches, APs, cameras)
- You do not want to learn CLI-based network configuration
Buy both (MikroTik router + UniFi AP) if:
- You want the best of both worlds: MikroTik routing/firewall automation with UniFi wireless management
- This is what I would do if I were starting a new homelab today. MikroTik for the router, UniFi for the APs. The MikroTik handles VLANs, firewall, and VPN via Terraform. The UniFi AP handles wireless through its controller. Two vendors, two strengths, zero compromise.
Frequently Asked Questions
Can MikroTik and UniFi devices coexist on the same network?
Yes, they work together without issue. MikroTik handles routing and VLAN segmentation; UniFi APs broadcast the VLAN-tagged SSIDs. The key configuration point: the switch port connecting the UniFi AP must be a trunk port carrying all VLAN SSIDs. This is configured on the MikroTik side (bridge VLAN filtering) and the UniFi side (port profile with VLAN tagging). Both platforms handle this standard configuration well.
Is MikroTik really harder to set up than Ubiquiti?
Yes, initially. MikroTik's RouterOS has a learning curve that takes 2-4 weeks to climb for basic proficiency. Ubiquiti's UniFi can be configured in an afternoon. But the long-term payoff is significant: once you understand RouterOS, you can configure any networking scenario without vendor lock-in. The knowledge transfers to Cisco, Juniper, and every other networking platform. UniFi knowledge stays within the UniFi ecosystem.
Should I use MikroTik for my home Wi-Fi?
Not directly. MikroTik makes access points (hAP ac3, cAP ax), but their wireless performance and roaming are inferior to UniFi's. MikroTik excels at routing and switching; let a dedicated AP handle wireless. Pair an RB5009 with a UniFi U6 Lite or U6 Pro for the best of both worlds.
How does MikroTik security compare to Ubiquiti?
MikroTik's firewall is more configurable but requires manual hardening. RouterOS 7 has had security vulnerabilities (WinBox CVE in 2018, Chimay Red attacks), but MikroTik patches quickly and the attack surface is manageable with proper firewall rules and by disabling unused services. UniFi's IDS/IPS provides automated threat detection that MikroTik lacks natively, but the black-box nature of the detection limits its utility for security-conscious users who want full visibility.
Can I manage MikroTik with Terraform?
Yes, the routeros Terraform provider is mature and actively maintained. It covers interfaces, bridges, VLANs, firewall rules, DHCP, DNS, WireGuard, routing, and more. I manage my entire MikroTik RB5009 configuration through Terraform โ every change goes through Git, gets reviewed, and is applied via Atlantis. The provider is at version 1.x and supports RouterOS 7.x. See the Terraform VLAN filtering article for a real-world example.
What is the best MikroTik router for a home lab?
The RB5009 is the sweet spot. It has 7 Gigabit ports (enough for most homelabs), a 10G SFP+ uplink for future-proofing, a switch chip for hardware-offloaded VLANs, and RouterOS 7 with full feature support. The hEX S (โฌ70) is the budget option but lacks the 10G port and has a less capable switch chip. The CCR2004 (โฌ300+) is overkill for home use unless you need 10Gbps routing throughput.
Conclusion
This is not a close comparison โ but it is not a one-sided one either.
MikroTik wins for any homelab running infrastructure-as-code. The Terraform integration, the granular firewall control, the hardware-offloaded VLAN switching, and the 10G SFP+ uplink make the RB5009 the definitive choice for engineers who want to own their network stack. At โฌ180, it is also the better value for routing performance.
Ubiquiti wins for whole-home networking where ease of use, ecosystem integration, and built-in Wi-Fi matter more than IaC automation. The UniFi Controller is the best consumer networking management platform available, and the ecosystem of switches, APs, and cameras is genuinely compelling.
For a homelab running Proxmox, K3s, and Terraform: buy the MikroTik RB5009. The learning curve pays for itself in flexibility, control, and the ability to manage your network the same way you manage your servers โ as code.
๐ Azure Zero-Trust Starter Pack โ โฌ99
- Includes: Acmebot Enterprise VNet, Hub & Spoke Zero-Trust, Azure Firewall Forced Tunneling
- Save โฌ48 vs. buying the three modules separately
- Bonus: ISO 27001 Auditor Checklist (PDF) - Annex A control map for all 3 modules
- Everything to pass your first Azure compliance audit
- Full source code for all 3 modules - no lock-in, no black box
Full source code ยท one-time payment ยท instant download
Top comments (0)