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=stubMulti-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=stubRoute 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=yesAuthentication
Always enable MD5 authentication between OSPF neighbors:
BASH
/routing ospf interface-template set [find] auth=md5 auth-key=YourSecureKey123Verification
BASH
/routing ospf neighbor print
/ip route print where routing-mark~"ospf"
/routing ospf lsa printBest Practices
- Use loopback interfaces as router-IDs for stability
- Enable BFD for sub-second failure detection
- Set reference bandwidth to match your fastest links
- Document all area boundaries and summarization points
- 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.
