cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
32375
Views
38
Helpful
6
Replies

class-map match-all or match-any: exact difference

ericgarnel
Level 7
Level 7

What is the exact difference between match-all & match-any?

from:

http://www.cisco.com/en/US/products/hw/switches/ps708/products_command_reference_chapter09186a0080161029.html#wp1021242

it states the following:

class-map

To access the QoS class map configuration mode to configure QoS class maps, use the class-map command. To delete a class map, use the no form of this command.

class-map name [match-all | match-any]

no class-map name [match-all | match-any]

Syntax Description

name

Class map name.

match-all

(Optional) Matches all match criteria in the class map.

match-any

(Optional) Matches one or more match criteria.

Defaults

When you do not specify the match-all or match-any keyword, the default is match-all.

So, if I have 6 match lines under my class, would match-any & match-all behave the same?

The definition seems very vague to me

Thanks,

Eric

1 Accepted Solution

Accepted Solutions

Pavel Bykov
Level 5
Level 5

Hello.

In Match-any:

Any one line has to match for match to occur.

In Match-all:

ALL lines have to match for match to occur.

I.E.:

1.

class-map match-all ABC

match access-group 10

match access-group 20

--In this case packet has to match both ACL 10 AND ACL 20

2.

class-map match-any ABC

match access-group 10

match access-group 20

--In this case packet has to match AT LEAST one access list.

Hope this helps.

Please rate if it does.

View solution in original post

6 Replies 6

Pavel Bykov
Level 5
Level 5

Hello.

In Match-any:

Any one line has to match for match to occur.

In Match-all:

ALL lines have to match for match to occur.

I.E.:

1.

class-map match-all ABC

match access-group 10

match access-group 20

--In this case packet has to match both ACL 10 AND ACL 20

2.

class-map match-any ABC

match access-group 10

match access-group 20

--In this case packet has to match AT LEAST one access list.

Hope this helps.

Please rate if it does.

Thanks, That is a clearer explanation

ankbhasi
Cisco Employee
Cisco Employee

Hi Eric,

If you have 6 statements under your class and you have "match all" keyword selected than class map will be triggered only if all statements hold true so for class to come in action all 6 statements/conditions should match and if you have selected "match any" keyword then any of the statement hold true out of 6, class map will trigger.

HTH

Ankur

Hi, one question, What's the recommendation to use, Match-any or Match-all?

 

Thanks for your comments.

Strictly depends on your match requirements logic.

Effectively "any" is a logical "or" between match statements while an "all" is a logical "and".

patkszen
Level 1
Level 1

I guess another way of configuring this would be to have an ACL with multiple permit or/and deny rules and use match-all for your class-map. All depends on your requirements. 

Review Cisco Networking for a $25 gift card