cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2324
Views
2
Helpful
4
Replies

Difference between matches-every and matches-within

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?

--
Network Engineer
CCIE SP #69245
1 Accepted Solution

Accepted Solutions

Your interpretation is correct.  For another example of "matches-within" RPL, see the A9K Command Ref:

https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/routing/command/reference/b-routing-cr-asr9000/routing-policy-language-commands.html#wp4149428420

 

Disclaimers: I am long in CSCO. Bad answers are my own fault as they are not AI generated.

View solution in original post

4 Replies 4

Your interpretation is correct.  For another example of "matches-within" RPL, see the A9K Command Ref:

https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/routing/command/reference/b-routing-cr-asr9000/routing-policy-language-commands.html#wp4149428420

 

Disclaimers: I am long in CSCO. Bad answers are my own fault as they are not AI generated.

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.

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).

M02@rt37
VIP
VIP

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.

 

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.