BGP filter with as-path

Hi , Anyone how are you ?

Today I have a question about Mikrotik OS7 v 7.12 Filtering bgp routes. My connection is iBGP with an ISP. I want to Filter / reject some as-paths. Recently I used this filter.

if (bgp-as-path 7XXX) {reject}

When I add this filter on the bgp I’m connected to, I check the route and I still get This as-path comes along. Therefore, I would like to ask for advice from all knowledgeable people. Please advise me, for example, is my filter command wrong? Or is there another command to make it work correctly?


Thank you all in advance.

it will be visible, but filtered and inactive?

i checked is show active but i try on some Os6 is rejected not show route of that as i don’t know on os7 what is correct filter command

Thankyou

Accept

if (dst in xxx.xxx.xxx.0/24 && dst-len in 24-32) { accept; }

Reject

if (dst in xxx.xxx.xxx.0/24 && dst-len in 24-32) { reject; }

Routeros 7 Filter syntax

https://help.mikrotik.com/docs/display/ROS/Route+Selection+and+Filters

You need to apply the correct syntax to get the desired match.

if (bgp-as-path ^6939) {reject} = reject any routes that begin with AS6939
if (bgp-as-path 6939$) {reject} = reject any routes with origin AS6939

https://help.mikrotik.com/docs/display/ROS/Route+Selection+and+Filters#RouteSelectionandFilters-AS-PATHRegexpMatching

Thankyou somuch