Community discussions

MikroTik App
 
sander123
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Wed Oct 28, 2020 11:58 pm

V7 OSPF Default Route Metric

Fri Dec 10, 2021 10:35 am

Hello,

How can i set a metric for the default route via OSPF.
We want router1 to be the primary default and router2 the back-up for all other routers in our network.

In V6 you could do it under the Instance settings, see screenshot.

In v7 there is no such option, i have tried it with a route filter like: add chain=ospf-out-v2 rule="if (dst==0.0.0/0) {set ospf-ext-metric 20; accept;}"
But it lookes like it is getting ignored.
You do not have the required permissions to view the files attached to this post.
 
aleksis
newbie
Posts: 25
Joined: Wed Apr 30, 2014 12:13 pm

Re: V7 OSPF Default Route Metric

Fri Dec 10, 2021 11:23 am

Setting metric in v7 is possible only with filters and it looks like you did everything correctly.
Are you using 'originate-default=always'?
It works for me:
/routing/ospf/instance/print
name="default-v2" version=2 vrf=main router-id=main out-filter-chain=ospf-test

/routing/filter/rule/print
chain=ospf-test rule="if (dst==0.0.0/0) {set ospf-ext-metric 20; accept;}"

/routing/ospf/lsa/print
SD instance=default-v2 type="external" originator=192.168.100.1 id=0.0.0.0 sequence=0x80000001 age=1 checksum=0x5719 body=
        options=E
        netmask=0.0.0.0
        forwarding-address=0.0.0.0
        metric=20 type-1
        route-tag=0
 
sander123
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Wed Oct 28, 2020 11:58 pm

Re: V7 OSPF Default Route Metric

Fri Dec 10, 2021 11:49 am

I dit using: Are you using 'originate-default=always'

I dit not check /routing/ospf/lsa/print
I have downgraded the router for now to v6 so i can not test it during work hours.

If it is the correct way, i will check again during evening or build a small test test set-up.
 
aleksis
newbie
Posts: 25
Joined: Wed Apr 30, 2014 12:13 pm

Re: V7 OSPF Default Route Metric

Fri Dec 10, 2021 11:54 am

Unfortunately the problem here is that the filters wont work on default dst originated from 'originate-default=always'.
In my case the default is originated from routing table dst.
 
sander123
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Wed Oct 28, 2020 11:58 pm

Re: V7 OSPF Default Route Metric

Fri Dec 10, 2021 12:04 pm

Oke, i don't really understand what you mean?

So i need to disable the originate-default option
Create a filte rule with: add chain=ospf-out-v2 rule="if (dst==0.0.0/0) {set ospf-ext-metric 20; accept;}"

And then i lose you, because if i do so no default route is given..
 
aleksis
newbie
Posts: 25
Joined: Wed Apr 30, 2014 12:13 pm

Re: V7 OSPF Default Route Metric

Fri Dec 10, 2021 5:18 pm

Sorry for not being clear.
Currently it is not possible to change metric for default originated with 'originate-default=always' as the filters are not applied in that case.
In my case I had default route within my routing table (static) and so the filter worked as expected.
 
sander123
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Wed Oct 28, 2020 11:58 pm

Re: V7 OSPF Default Route Metric

Fri Dec 10, 2021 5:20 pm

No problem, happy with your help!

Oké but on my router1 and router2 i also have a static default route
so in theory i should be possible to give it through to other routers (router3 router4 etc) via a route filter? if i understand you correctly..
 
aleksis
newbie
Posts: 25
Joined: Wed Apr 30, 2014 12:13 pm

Re: V7 OSPF Default Route Metric

Mon Dec 13, 2021 7:54 am

Yes, then filter should be sufficient and 'originate-default=' is not necessary.

Who is online

Users browsing this forum: No registered users and 21 guests