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

Answered Question
Aug 15th, 2007

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

I have this problem too.
0 votes
Correct Answer by Pavel Bykov about 9 years 3 months ago

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Pavel Bykov Wed, 08/15/2007 - 08:33

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.

ankbhasi Wed, 08/15/2007 - 08:35

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

Actions

This Discussion