OSPF Route Filter Issue

Can someone explain why this filter doesn’t work? (RouterOS 5.6)

/routing filter
add action=accept chain=ospf-out disabled=no invert-match=no prefix=
1.2.3.0/29 prefix-length=29
add action=discard chain=ospf-out disabled=no invert-match=no prefix=0.0.0.0/0
prefix-length=0-32
add action=accept chain=ospf-in disabled=no invert-match=no prefix=0.0.0.0/0
prefix-length=0
add action=discard chain=ospf-in disabled=no invert-match=no prefix=0.0.0.0/0
prefix-length=1-32

The configuration is:

Main (Wireless) Connection – (Cost 20) – Customer Router – (Cost 67) Backup (T-1) Connection

The inbound filter (on the Customer Router) appears to work, since the routing table only shows a default route learned by OSPF. However, the router on the end of the backup connection is receiving a bunch of routes that the customer router is receiving from the “Main Connection”. “Redistribute Other OSPF Routes” is set to “no”. Is this a bug or am I doing something wrong?

-Matt

It’s not entirely clear what you’re trying to do (how are the routers connected, what are the OSPF areas, what routing protocol runs on what link, etc.), but if you’re trying to filter routes already in OSPF from being advertised to other OSPF routers, you cannot do that. OSPF by design requires that all routers have the same LSDB (link state database), and if you don’t send all the routers you know to other routers you are violating that principle. You can opt not to install those received routes in the routing tables and keep them in the LSDB only, but you cannot keep them from being advertised as that would fundamentally violate how OSPF works.