07-18-2023 10:07 AM
Hi everyone,
What is the difference between `matches-any` and `matches-within` in this context?
RP/0/RP0/CPU0:R6(config)#route-policy FOO
RP/0/RP0/CPU0:R6(config-rpl)#if community ?
is-empty Route has no BGP community attributes
length Length of BGP AS-path
matches-any At least one community from the route matches an element of a community set
matches-every Every element of a community set matches a community from the route
matches-within Every community from the route matches an element of a community set
RP/0/RP0/CPU0:R6(config-rpl)#
Let's say my community-set BAR has these communities:
1:100
1:200
1:300
`if community matches-any` means "This route must have one of the communities in BAR to match"
`if community matches-every` means "This route must have all of these communities to match"
but what does `matches-within` mean?
Does it mean, "every community that this route has must be in the list BAR" ???
E.g. the following would pass
1.1.1.1/32 with 1:100, 1:200 and 1:300
1.1.1.1/32 with 1:100
But this would fail:
1.1.1.1/32 with 1:100, 1:200, 1:300 and 1:400 - just because 1:400 is not in BAR.
Is that correct?
Solved! Go to Solution.
07-18-2023 10:58 AM
Your interpretation is correct. For another example of "matches-within" RPL, see the A9K Command Ref:
07-18-2023 10:58 AM
Your interpretation is correct. For another example of "matches-within" RPL, see the A9K Command Ref:
07-19-2023 06:36 AM
I dont sure your exmaple correct'
You mention BAR list' does within meaning any or every community list ?
I think within as I explained below is simply wildcard ANY.
07-18-2023 11:16 AM
community 1:100 2:100 3:100 4:200 5:300
match-any <<- any of community of above will match
match-every <<- all community of above must match
BUT what if I need to match only *:100 i.e. any community :100 here we use match-within (it like wildcard).
07-18-2023 12:33 PM
Hello @steven.crutchley,
The "matches-any" keyword is used to specify that at least one community from the route being evaluated must match an element of a community set.
If any community from the route does not have a match within the community set, the condition would fail.
The "matches-within" keyword is used to specify that every community from the route being evaluated must match an element of a community set.
If there is at least one matching community, the condition would pass.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide