Skip to content
Back to Blog
MikroTik

Building a Multi-Site MikroTik Network with OSPF

A complete guide to designing and deploying multi-site OSPF routing with MikroTik RouterOS for enterprise branch offices.

Jan 2025
12 min read

Overview

OSPF (Open Shortest Path First) is the go-to dynamic routing protocol for enterprise multi-site networks. This guide walks through deploying OSPF across MikroTik routers at multiple branch offices.

Prerequisites

  • MikroTik RouterOS 7.x
  • Site-to-site connectivity (MPLS, VPN, or leased lines)
  • IP addressing plan with /30 links between routers

Basic OSPF Configuration

BASH
# Enable OSPF instance on RouterOS 7
/routing ospf instance add name=main router-id=10.0.0.1

# Create OSPF area
/routing ospf area add name=backbone instance=main area-id=0.0.0.0

# Add network interfaces to OSPF
/routing ospf interface-template add area=backbone interfaces=ether1 type=ptp
/routing ospf interface-template add area=backbone interfaces=lo0 type=stub

Multi-Area Design

For larger deployments, use multiple OSPF areas to reduce LSA flooding:

  • Area 0 (Backbone): Core routers and inter-site links
  • Area 1 (Branch offices): Stub areas for branch LANs
  • Area 2 (DMZ): NSSA for internet-facing segments
BASH
# Configure stub area for branch
/routing ospf area add name=branch1 instance=main area-id=0.0.0.1 type=stub

Route Summarization

Summarize branch prefixes at ABRs to reduce routing table size:

BASH
/routing ospf area-range add area=branch1 prefix=192.168.10.0/23 advertise=yes

Authentication

Always enable MD5 authentication between OSPF neighbors:

BASH
/routing ospf interface-template set [find] auth=md5 auth-key=YourSecureKey123

Verification

BASH
/routing ospf neighbor print
/ip route print where routing-mark~"ospf"
/routing ospf lsa print

Best Practices

  1. Use loopback interfaces as router-IDs for stability
  2. Enable BFD for sub-second failure detection
  3. Set reference bandwidth to match your fastest links
  4. Document all area boundaries and summarization points
  5. Test failover by physically disconnecting a link — not just shutting it down

OSPF on MikroTik is production-ready and scales well to 20+ sites. Keep your area design simple and your authentication consistent.