Community discussions

MikroTik App
 
martinb
just joined
Topic Author
Posts: 21
Joined: Tue Jan 26, 2016 1:49 pm

Redistribute static routes to OSPF

Mon Nov 07, 2016 10:51 am

Hello all,

I have very simple question but unfortunatly I still have not found the answer. Before I start to describe my scenario I would like to say that I have already make a research about this specific scenario but I cant find the answer. Everything was about classic redistribution from static to OSPF.

I have mikrotik with OSPF and Static routes. There are some "S" routes and also "DAS" which stands for dynamic static. I know how to redistribute static routes into OSPF but I need to redistribute only some specific routes from the list of the static routes. I know there is "routing -> filter" but I am not sure if this filter works as I think it works.

I achieved only two results. 1. Nothing was redistributed. 2. Every static route was redistributed.

Can someone post me his advice, please?

For instance, in cisco environment I can use "route-map" with "access-list" or "prefix-list" defining which specific static route I want to redistribute.

Thank you very much for help.
 
vaizki
newbie
Posts: 32
Joined: Wed Mar 23, 2011 3:44 pm
Location: Finland

Re: Redistribute static routes to OSPF

Mon Nov 07, 2016 12:48 pm

Yes you can use the filters to discard routes. The OSPF instances have by default the filter chain "ospf-out" set as the out filter.

So for example to allow only routes in 192.168.0.0/16 to be distributed and the rest discarded:
/routing filter
add chain=ospf-out prefix=192.168.0.0/16 action=accept
add chain=ospf-out action=discard

Note that filter rules are like firewall rules here, the order is very important.
 
vaizki
newbie
Posts: 32
Joined: Wed Mar 23, 2011 3:44 pm
Location: Finland

Re: Redistribute static routes to OSPF

Mon Nov 07, 2016 1:31 pm

So for example to allow only routes in 192.168.0.0/16 to be distributed and the rest discarded:
/routing filter
add chain=ospf-out prefix=192.168.0.0/16 action=accept
add chain=ospf-out action=discard
Suddenly realized I was a bit misleading here. That discard rule will only match the exact route of 192.168.0.0/16, not a more specific one like 192.168.1.0/24 .. to match all routes inside a larger netmask that you would need to also set a prefix-length for the filter entry.
 
martinb
just joined
Topic Author
Posts: 21
Joined: Tue Jan 26, 2016 1:49 pm

Re: Redistribute static routes to OSPF

Mon Nov 07, 2016 4:15 pm

So for example to allow only routes in 192.168.0.0/16 to be distributed and the rest discarded:
/routing filter
add chain=ospf-out prefix=192.168.0.0/16 action=accept
add chain=ospf-out action=discard
Suddenly realized I was a bit misleading here. That discard rule will only match the exact route of 192.168.0.0/16, not a more specific one like 192.168.1.0/24 .. to match all routes inside a larger netmask that you would need to also set a prefix-length for the filter entry.

Dear vaizki,

I have already tried this before. I just renamed the filter "ospf-out" to something other, but I guess this is not a problem. Next, I had prefix and prefix-length with action accept. The next rule was deny everything else. I did this in the same way as you suggested me right now. But the result was very strange. There was blocked everything. It was like the filter skipped the first rule.

I tested it in other ways but as I wrote earlier, I achieved only two situations = either everything was blocked or eveerything was allowed.
 
faisali
Member Candidate
Member Candidate
Posts: 180
Joined: Fri Oct 08, 2010 5:11 am

Re: Redistribute static routes to OSPF

Sun Dec 11, 2016 1:30 am

How about the following:-

in the default ospf instance, do not redistribute static routes
and put the prefix you want to re-distribute in the network sections of ospf
 
fallegretti
newbie
Posts: 33
Joined: Thu Jul 20, 2017 1:23 pm

Re: Redistribute static routes to OSPF

Thu Nov 16, 2017 5:28 pm

@martinb
I believe the name is a problem. There are some predifined chains and for ospf are ospf-in and ospf-out and I believe you will have to use those to filter in OSPF

Who is online

Users browsing this forum: No registered users and 13 guests