Fairly simple (I think...) OSPF implementation

First of all, thanks the the Mikrotik folks for hosting this forum!

I have just inherited a network consisting of 6 routerboard based mikrotil routers. 5 are running 4.10 and 1 is running 4.11. They are currently in a ring configuration, with no dynamic routing. Nothing but static routes. Lot’s of them. And of course when anything breaks, one needs to scramble to reroute things. I’m very familiar with EIGRP, and somewhat familiar with OSPF – but both in Cisco environments. I’ve done quite a bit of in-depth reading of the Mikrotik manual/wiki, and quite a bit here as well. I think I understand what I need to do, but I’d like to be sure. I’m hoping that someone here in the forum can just sanity check what I’m about to do – and maybe steer me in the right direction if I’m out of my mind..

The attached .jpg is a fair representation of the network.

Do the configs below look correct? Can I implement this with all of the static routes intact, then simply remove them? One thing that I’m not sure about, is how to weight the routes. I need all traffic from routers 1 and 4 to ‘prefer’ the .10x.0 route, and only use the .20x.0 route when the preferred route goes down

What I’ve come up with is as follows:

R1
/routing ospf instance> add name=default
/interface bridge> add name=loopback
ip address add address=10.255.255.1/32 interface=loopback
/routing ospf network> add network=1.1.1.0/30 area=backbone
/routing ospf network> add network=10.100.10.0/24 area=backbone
/routing ospf network> add network=10.100.11.0/24 area=backbone
/routing ospf network> add network=10.100.101.0/24 area=backbone
/routing ospf network> add network=10.100.202.0/24 area=backbone



R2
/routing ospf instance> add name=default
/interface bridge> add name=loopback
ip address add address=10.255.255.2/32 interface=loopback
/routing ospf network> add network=10.100.101.0/32 area=backbone
/routing ospf network> add network=10.100.102.0/32 area=backbone


R3
/routing ospf instance> add name=default
/interface bridge> add name=loopback
ip address add address=10.255.255.3/32 interface=loopback
/routing ospf network> add network=10.100.102.0/32 area=backbone
/routing ospf network> add network=10.100.103.0/32 area=backbone


R4
/routing ospf instance> add name=default
/interface bridge> add name=loopback
ip address add address=10.255.255.4/32 interface=loopback
/routing ospf network> add network=10.100.50.0/24 area=backbone
/routing ospf network> add network=10.100.51.0/24 area=backbone
/routing ospf network> add network=10.100.103.0/32 area=backbone
/routing ospf network> add network=10.100.200.0/32 area=backbone

R5
/routing ospf instance> add name=default
/interface bridge> add name=loopback
ip address add address=10.255.255.5/32 interface=loopback
/routing ospf network> add network=10.100.200.0/32 area=backbone
/routing ospf network> add network=10.100.201.0/32 area=backbone


R6
/routing ospf instance> add name=default
/interface bridge> add name=loopback
ip address add address=10.255.255.6/32 interface=loopback
/routing ospf network> add network=10.100.201.0/32 area=backbone
/routing ospf network> add network=10.100.202.0/32 area=backbone


*** Thanks in advance for any Assistance!!!

Gene
MyOSPF.jpg

On R1 you may also want to distribute default route

/routing ospf instance set default distribute-default=if-installed-as-type-1

As far as the weight goes: OSPF uses the cumulative cost of all links to the destination, where a higher cost is less desirable. Cisco uses that (link-speed)/10^8 formula for a link’s cost by default, in RouterOS you just edit the Routing > OSPF > Interface instance (usually added dynamically as interfaces with IPs on networks you entered under IP > OSPF > Networks, which kinda works well with the network a.b.c.d router configuration command in IOS) and manually set the cost of the link the interface is connected to to something other than the default of 10. In your case you need to edit the interfaces that face R5 and R6 on R1 and R4 respectively and set them to a high cost. Those routes will then have a total higher cost except for from R5s and R6s perspective as they can’t escape them, and will not be offered to the routing table and will only kick in if the route through R1 - R4 fails.

Thank you both for your assistance! I’m feeling much better about this implementation. I’ll post an update after I implement all of this over the weekend.

Thanks again!

You have a number of these sort of networks:

/routing ospf network> add network=10.100.101.0/32 area=backbone

Where I suspect you meant either /30 or /24 depending on how you’ve divided up your address space. It appears you’re using a /30 out of those blocks as your transit links?

Depending on what you’re ultimately doing, you may also want to add a set-preferred-source filter in /routing filters for the ospf-in chain.

I would suggest you start out setting your costs to match the actual bandwidth of the interface, using the same formula for all the routers, and then adjust from there if necessary.

(I think cisco defaults to 100mbit/actual bandwidth=cost. but I would suggest a faster upper-end. If you use 10gbit, your slowest links can be 153 kbit, before you exhaust the cost range.)

Make sure you add the loopbacks as passive interfaces (the default cost of 10 is fine for the loopbacks). Also the interfaces on R1 with 10.0/24 and 11.0/24 and R4 with 50.0/24 and 51.0/24 need to be passive (unless you actually want them to speak ospf to other routers on those interfaces), or you need to distribute connected, or use bgp. Adding the interfaces as passive is probably easiest, and give you more control than distributing connected.

You can then delete the static routes, or change their distance to be higher than the ospf routes (110) so that they will only be used if ospf is down.