Community discussions

MikroTik App
 
rpra
newbie
Topic Author
Posts: 45
Joined: Tue Jan 24, 2012 8:43 pm

OSPF redistribute and routing filters in v7

Wed Mar 17, 2021 4:18 pm

Trying to set up lab on 7.1.beta5
I simply want to redistribute loopback addresses into ospf, but by default it does not work.
Started to set up filters, but they do not work as said in https://help.mikrotik.com/docs/display/ ... g+Examples
[admin@R1] > routing/filter/rule/add chain=ospf_out                                
failure: empty rule specified
[admin@R1] > routing/filter/rule/add chain=ospf_out rule="dst<subsumes>10.0.0.0/8"
failure: invalid action at dst
Maybe someone knows?
 
User avatar
StubArea51
Trainer
Trainer
Posts: 1739
Joined: Fri Aug 10, 2012 6:46 am
Location: stubarea51.net
Contact:

Re: OSPF redistribute and routing filters in v7

Wed Mar 17, 2021 5:12 pm

The syntax for routing filters has changed:

Details here:

viewtopic.php?f=1&t=173567#p848792

I'd expect something like:
/routing/filter/rule/add chain=ospf-redist rule={if [protocol connected] then={action do=accept}}
 
rpra
newbie
Topic Author
Posts: 45
Joined: Tue Jan 24, 2012 8:43 pm

Re: OSPF redistribute and routing filters in v7

Wed Mar 17, 2021 5:24 pm

The syntax for routing filters has changed:

Details here:

viewtopic.php?f=1&t=173567#p848792

I'd expect something like:
/routing/filter/rule/add chain=ospf-redist rule={if [protocol connected] then={action do=accept}}
Thanks, but I still can't understand how to use that "chains" or "select chains"

Can you please show full config for "redistribute static/connected with some filtering" scenario?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: OSPF redistribute and routing filters in v7

Wed Mar 17, 2021 5:34 pm

Just need to specify chain in instance and add one rule.
/routing ospf instance set <xxx> out-filter-chain=myChain
/routing filter rule add chain=myChain rule={ if ([protocol connected]) then={num-value ospf-ext-metric<assign>10; ospf-ext-type type1; action accept}}
 
rpra
newbie
Topic Author
Posts: 45
Joined: Tue Jan 24, 2012 8:43 pm

Re: OSPF redistribute and routing filters in v7

Wed Mar 17, 2021 5:40 pm

Just need to specify chain in instance and add one rule.
/routing ospf instance set <xxx> out-filter-chain=myChain
/routing filter rule add chain=myChain rule={ if ([protocol connected]) then={num-value ospf-ext-metric<assign>10; ospf-ext-type type1; action accept}}
Ok, it looks working now.
What for are select-chain and select-rule?

And please help to figure out how to filter by prefix and prefix length?
 
dacoshild
just joined
Posts: 15
Joined: Wed Nov 11, 2020 12:24 pm

Re: OSPF redistribute and routing filters in v7

Thu Mar 18, 2021 1:57 pm

How would make equivalent of this?

- redistribute default route - never
- redistribute connected routes - as type 1
- redistribute static routes - as type 1

Can it be like this?:

0 chain=final rule=if ([protocol connected] || [protocol static]) then={action do=accept; ospf-ext-type type1}

1 chain=final rule=if ([prfx-value is=dst<equal>0.0.0.0/0] || [protocol static]) then={action do=reject}
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: OSPF redistribute and routing filters in v7

Thu Mar 18, 2021 2:02 pm

Firsts reject default route and then accept static,connected

or you can write in one rule
if ([prfx-value is=!dst<equal>0.0.0.0/0] || [protocol static] || [protocol connected]) { ospf-ext-type type1; action accept}
 
dacoshild
just joined
Posts: 15
Joined: Wed Nov 11, 2020 12:24 pm

Re: OSPF redistribute and routing filters in v7

Thu Mar 18, 2021 2:49 pm

Thank you mrz!
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: OSPF redistribute and routing filters in v7

Thu Mar 18, 2021 8:01 pm

Some more info on new filter syntax now is available here:
https://help.mikrotik.com/docs/display/ ... g+Examples
 
dacoshild
just joined
Posts: 15
Joined: Wed Nov 11, 2020 12:24 pm

Re: OSPF redistribute and routing filters in v7

Fri Mar 19, 2021 11:19 am

How can I set ospf cost? Before it was just "routing ospf area set <xxx> default-cost=<xxx>

I just cannot find it enywhere.

Who is online

Users browsing this forum: wawananakkaili and 34 guests