Community discussions

MikroTik App
 
dconnrt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Mon Jul 28, 2008 10:53 pm

ospf - route weighting possible?

Mon Mar 29, 2010 11:46 pm

Hi all,

I'm sure I missing something with this isssue with OSPF:

I have a MT router with two wireless links back to the data centre. Both of the wireless routes from this router are two IP hops. Due to this OSPF is showing both outgoing routes in the 0.0.0.0/0 default route ("XXX.XXX.XXX.XXX reachable via ether1, XXX.XXX.XXX.XXX reachable via ether2).

To be fair its doing a great job load-balancing.

The trouble, for me, is one of my links is the one I want to use all the time and I only want to use the slower link as a backup if something goes wrong with the first link.

I really want to be able to weight one route somehow. the OSPF "metrics" don't seem to be the thing for this (because all OSPF routes always appear to be 110 distance no matter what).

Does anyone know how to make OSPF prefer one route over another when both have the same hop count?

thanks,

Derek
 
eflanery
Member
Member
Posts: 376
Joined: Fri May 28, 2004 10:11 pm
Location: Moscow, ID
Contact:

Re: ospf - route weighting possible?

Tue Mar 30, 2010 12:08 am

What you are looking for is the ospf interface "cost", not the "metric" or the "distance".

The "cost" describes how different interfaces should be weighted. So for example you could set your primary interface to cost=10, while the backup interface could be cost=100. This would cause traffic to exclusively flow over the primary interface, unless and until it goes down.

The "metric" describes what cost should be added to external routes redistributed into OSPF, and generally should not be messed with.

The "distance" describes how the main routing table should choose amongst otherwise identical routes from different protocols, and should also not usually be messed with.
 
dconnrt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Mon Jul 28, 2008 10:53 pm

Re: ospf - route weighting possible?

Tue Mar 30, 2010 12:26 am

Hi eflanery,

Absolutely perfect - this is what I was missing. Increasing the cost for the Interface has sorted it out

thanks very much!!!!

Derek
 
temuri426
Frequent Visitor
Frequent Visitor
Posts: 85
Joined: Fri Apr 30, 2010 1:47 pm

Re: ospf - route weighting possible?

Fri May 07, 2010 8:54 am

hi all...i have a question about wireless connection..

does SPF algorithm runs any time when bandwidth variates between two wirelesss router?
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: ospf - route weighting possible?

Fri Jun 11, 2010 7:41 pm

im having trouble understanding how to accomplish this. I have a failover router at the end of the backbone that has a dhcp default gateway. how can i change the cost of that route so it's only used if there isn't another default route?

ether1 is dhcp internet.
ether2 is connection to 2 downstream routers using ospf using redundant paths.

ether1 is only the internet connection, so it doesnt participate with ospf, or if configured sits there in down state.

I can't increase the cost on ether2 because that would make all other routes traversing that path to not be preferred. it doesn't seem to work anyhow, it only adds cost to routes on that interface, not ether1.

How can I increase the cost on a default gateway in ospf?
 
eflanery
Member
Member
Posts: 376
Joined: Fri May 28, 2004 10:11 pm
Location: Moscow, ID
Contact:

Re: ospf - route weighting possible?

Wed Jun 16, 2010 11:49 pm

To weight default routes in OSPF, the easiest way is to set distribute-default to Type 2 External, and adjust the "metric-default" for that OSPF instance.

Type 2 default distribution will take only the instance "metric-default" into account, so you can set to 1 on your preferred egress router, 2 on the second choice, and so on. Equal "metric-default" settings will cause ECMP.

If you want to take internal OSPF costs into account, you can distribute the default as Type 1 External, which will add the "metric-default" to the egrees interface's OSPF cost (there don't actually need to be any OSPF adjacencies on the egress interface). That sum will then be added to the OSPF path cost to reach the egress router.

That said, I personally recommend against having a default in OSPF, or any routes other than loopbacks for that matter. BGP gives far better controls for tracking external destinations, and nothing is generally more external than a default route.

--Eric
 
ihernandez
Member Candidate
Member Candidate
Posts: 151
Joined: Sat Apr 12, 2008 4:18 pm

Re: ospf - route weighting possible?

Fri Jun 13, 2014 2:13 am

Hi guys, I have the same scenario. Two wireless links ether1 and ether4 to point b. I managed to add manually in routing>ospf>interface ether4 with a cost of 10 because I want it to be the primary and the backup is ether1 with a higher cost of 100.
In ip>routes my router shows dst address 0.0.0.0/0 and the correct gateway 10.70.3.137 on the correct interface ether4

however the traffic is still balanced between the "primary" and the "secondary" link and not being sent over the primary link exclusively, could you give me pointers on where to look?