Community discussions

MikroTik App
 
voxframe
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Thu Dec 16, 2010 2:51 pm

OSPF - 2 Default gateways, how to set one preffered?

Wed Mar 27, 2013 4:27 pm

This is a very simple question, that I cannot seem to implement the way I assume it should be.

I have a router (C), talking to two other routers(A-B) VIA OSPF. Both of the routers can be (and advertise) default gateways. One is the main gateway, the other is a backup.
How do I set OSPF to only use one of the two gateways, unless the main one is not available, then it will failover onto the second gateway.
ROUTER A (Gateway1)--------ROUTER C---------ROUTER B (Gateway2)
Normally I want to accept default gateways from Router A and B. But I only want to use Gateway1. I only want Gateway2 active if Gateway1 is not reachable.

I ASSUME I do this with setting routing distance. The problem I am having, is how do I set routing distance for OSPF routes, coming from a specific interface?
I ASSUME that setting Cost in the OSPF>INTERFACE menu of the interface facing Router B, to a high number (150) would fix the problem. But no matter what I set this value for, it always sets the Distance to 110.

What parameter controls the Distance of a route coming in on OSPF for one particular interface? Or can I accomplish this with filters? I don't see how I can match an interface in the filters.

Or would I normally set this parameter on Router B?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: OSPF - 2 Default gateways, how to set one preffered?

Wed Mar 27, 2013 4:44 pm

Route distance is not the same as ospf route cost.
You can prioritize one ospf route over another by adjusting interface costs. Example how costs are calculated is in the manual
http://wiki.mikrotik.com/wiki/Manual:OS ... alculation
 
voxframe
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Thu Dec 16, 2010 2:51 pm

Re: OSPF - 2 Default gateways, how to set one preffered?

Wed Mar 27, 2013 5:48 pm

That is what I did, and it didn't seem to make any difference.

I set the cost on the interface facing the backup router higher (Example 200)
compared to the lower cost on the interface to the main gateway (Example 10)

It still takes the default gateway for the backup router.

I should draw a better diagram. Perhaps this is also an issue.
GATEWAY1(A) ------ ROUTER C ------ ROUTER D ------- ROUTER E ------- ROUTER F ------ ROUTER G ------ GATEWAY2(B)
I am now working on router G

I want ALL routers to use the default Gateway1 (A) and not Gateway2 (B) unless the chain breaks (Example, cut between E and F)

Yes I realize this is not "efficient" but it is how it needs to work.

What router would I set this cost?
I try on router G to set the interface towards B to 200 and the interface to A to 10... It still takes the gateway from B.

Do I need to make any more cost adjustments on other routers?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: OSPF - 2 Default gateways, how to set one preffered?

Thu Mar 28, 2013 10:22 am

Easier for you is to distribute default route on both edge routers as type-2 And in ospf instance on RouterB set default metric higher than on RouterA
 
voxframe
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Thu Dec 16, 2010 2:51 pm

Re: OSPF - 2 Default gateways, how to set one preffered?

Thu Mar 28, 2013 2:33 pm

AHH! This might work!

I am currently using Type 1 as well. Perhaps this is my problem for it not calculating properly?

Who is online

Users browsing this forum: No registered users and 26 guests