eliminated and the queue is no longer full). The
following example configures a traffic policy for the default
class of the traffic policy called policy1. The default class
(which is always called class-default) has these
characteristics: 10 queues for traffic that does not meet the
match criteria of other classes whose policy is defined by the
traffic policy policy1, and a maximum of 20 packets per queue
before tail drop is enacted to handle additional queued
packets. Router(config)# policy-map policy1
Router(config-pmap)# class class-default
Router(config-pmap-c)# fair-queue 10
Router(config-pmap-c)# queue-limit 20 Example:
class-map match-any and class-map match-all Commands
These examples illustrate the difference between the
class-map match-any command and the class-map
match-all command. The match-any and
match-all options determine how packets are evaluated
when multiple match criteria exist. Packets must either meet
all of the match criteria (match-all) or one of the
match criteria (match-any) in order to be considered a
member of the traffic class. This example shows a traffic class
configured with the class-map match-all command:
Router(config)# class-map match-all cisco1
Router(config-cmap)# match protocol ip
Router(config-cmap)# match qos-group 4
Router(config-cmap)# match access-group 101 If a packet
arrives on a router with traffic class called cisco1 configured
on the interface, the router evaluates the packet to determine
if it matches the IP protocol, QoS group 4, and access group
101. If the packet meets all three of these match criteria, the
packet matches traffic class cisco1. The following example
shows a traffic class configured with the class-map
match-any command: Router(config)# class-map match-any
cisco2
Router(config-cmap)# match protocol
ip
Router(config-cmap)# match qos-group 4
Router(config-cmap)# match access-group 101 In traffic
class called cisco2, the router evaluates the match criteria
consecutively until a successful match criterion is located.
The packet evaluation determines whether IP protocol can be
used as a match criterion. If IP protocol can be used as a
match criterion, the packet is matched to traffic class cisco2.
If IP protocol is not a successful match criterion, then QoS
group 4 is evaluated as a match criterion. Each matching
criterion is evaluated to see if the packet matches that
criterion. Once a successful match occurs, the packet is
classified as a member of traffic class cisco2. If the packet
matches none of the specified criteria, the packet is
classified as a member of the traffic class, default class.
Note that the class map match-all command requires that
all of the match criteria must be met in order for the packet
to be considered a member of the specified traffic class (a
logical AND operator). In the example, protocol IP AND QoS
group 4 AND access group 101 have to be successful match
criteria. However, only one match criterion must be met for the
packet in the class map match-any command to be
classified as a member of the traffic class (a logical OR
operator). In the example, protocol IP OR QoS group 4 OR access
group 101 have to be successful match criteria.
Content
3.4 Using MQC for Implementing QoS
3.4.6 Step 3: Attaching a Service Policy to Interfaces
Like an ACL, you must apply the policy map to the specific
interface you want it to affect. You can apply the policy map
in either output or input mode. The last configuration step
when configuring QoS mechanisms using the Cisco MQC is to
attach a policy map to the inbound or outbound packets using
the service-policy command. The router immediately
verifies the parameters that are used in the policy map. If
there is a mistake in the policy map configuration, the router
displays a message explaining what is wrong with the policy
map. The sample configuration in Figure shows how a policy map
is used to separate HTTP from other traffic. HTTP is guaranteed
2 Mbps of bandwidth. All other traffic belongs to the default
class and is guaranteed to get 6 Mbps of bandwidth. Example:
Traffic Policy Attached to an Interface
The following
example shows how to attach an existing traffic policy (that
was created in the example "Traffic Policy Created")
to an interface. After you define a traffic policy with the
policy-map command, you can attach it to one or more
interfaces to specify the traffic policy for those interfaces
by using the service-policy command in interface
configuration mode. Although you can assign the same traffic
policy to multiple interfaces, each interface can have only one
traffic policy attached at the input and only one traffic
policy attached at the output. Router(config)# interface
e1/1
Router(config-if)# service-policy output
policy1
Router(config-if)# exit Router(config)#
interface fa1/0/0
Router(config-if)#
service-policy output policy1
Router(config-if)#
exit
Content 3.4 Using MQC for
Implementing QoS 3.4.7 Nested Class Maps
There are two reasons to use the match class-map
command. One reason is maintenance; if a long traffic class
currently exists, using the Traffic Class match criterion is
simply easier than retyping the same traffic class
configuration. The more prominent reason for the match
class-map command is to allow users to use match-any and
match-all statements in the same traffic class. If you want to
combine match-all and match-any characteristics in a traffic
policy, create a traffic class using one match criteria
evaluation instruction (either match any or match all) and then
use this traffic class as a match criterion in a traffic class
that uses a different match criteria type. A simple library
analogy illustrated in Figure will serve to clarify the
concept. Let us assume you are looking in a library database
for a book that covers the salaries of either football players
or hockey players. In Boolean terms, your search is represented
by the phrase (salaries AND [football players OR hockey
players]). This is a ‘nested search’, one search within
another. The part of the search enclosed in brackets, football
players OR hockey players, will be performed first, followed by
the AND operation. This search will retrieve items on salaries
and football players as well as items on salaries and hockey
players. The Venn diagram shows six different sectors, three of
which overlap to a degree. The overlapping area in the center
includes salaries, hockey players, and football players. The
area to the right of center contains items on salaries and
hockey players. The overlapping area to the left of center
contains items on salaries and football players. Only the left
of center and the right of center match our criteria. This next
example pertains to creating class maps. Suppose A, B, C, and D
were all separate match criterion, and you wanted traffic
matching A, B, or C, and D to be classified as belonging to the
traffic class. In Boolean terms, the nested equation is (A or B
or [C and D]). Without the nested traffic class, traffic would
either have to match all 4 of the match criterion (A and B and
C and D) or match any of the match criterion (A or B or C or D)
to be considered part of the traffic class. You would not be
able to combine "and" (match-all) and "or"
(match-any) statements within the traffic class, and you would
therefore be unable to configure the desired configuration. The
elegant solution is to create one traffic class using match-all
for C and D (which we will call criterion E), and then create a
new match-any traffic class using A, B, and E. The new traffic
class would have the correct evaluation sequence (A or B or E,
which would also be A or B or [C and D]). The desired traffic
class configuration is complete. The only method of including
both match-any and match-all characteristics in a single