V7 OSPF Default Route Metric

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.
Schermafbeelding 2021-12-10 om 09.31.43.png

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

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.

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.

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..

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.

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..

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