To attach a policy
map to an input interface, a virtual circuit (VC), an output interface, or a VC
that will be used as the service policy for the interface or VC, use the
service-policy
command in the appropriate configuration mode. To remove a service policy from
an input or output interface or from an input or output VC, use the
no form of this
command.
service-policy [type access-control] {input | output} policy-map-name
no service-policy [type access-control] {input | output} policy-map-name
Cisco 10000 Series and Cisco
7600 Series Routers
service-policy [history | {input | output} policy-map-name | type control control-policy-name]
no service-policy [history | {input | output} policy-map-name | type control control-policy-name]
Interface Template Configuration
service-policy [ access-control] {input | output | type control subcriber
}policy-map-name
no service-policy [ access-control] {input | output | type control subcriber
}policy-map-name
Syntax Description
type
access-control
|
(Optional)
Determines the exact pattern to look for in the protocol stack of interest.
|
input
|
Attaches
the specified policy map to the input interface or input VC.
|
output
|
Attaches
the specified policy map to the output interface or output VC.
|
policy-map-name
|
The name
of a service policy map (created using the
policy-map
command) to be attached. The name can be a maximum of 40 alphanumeric
characters in length.
|
history
|
(Optional) Maintains a history of quality of service (QoS) metrics.
|
type control
control-policy-name
|
(Optional) Creates a Class-Based Policy Language (CPL) control policy map that
is applied to a context.
|
type control subscriber
policy-map-name
|
Applies subscriber control policy to the interface.
|
Command Default
No service policy
is specified. A control policy is not applied to a context. No policy map is
attached.
Command Modes
ATM VC bundle configuration (config-atm-bundle)
ATM PVP configuration (config-if-atm-l2trans-pvp)
ATM VC configuration mode (config-if-atm-vc)
Ethernet service configuration (config-if-srv)
Global configuration (config)
Interface configuration (config-if)
Static maps class configuration (config-map-class)
ATM PVC-in-range configuration (cfg-if-atm-range-pvc)
Subinterface configuration (config-subif)
Template configuration (config-template)
Command History
Release
|
Modification
|
12.0(5)T
|
This
command was introduced.
|
12.0(5)XE
|
This
command was integrated into Cisco IOS Release 12.0(5)XE.
|
12.0(7)S
|
This
command was integrated into Cisco IOS Release 12.0(7)S.
|
12.0(17)SL
|
This
command was implemented on the Cisco 10000 series routers.
|
12.1(1)E
|
This
command was integrated into Cisco IOS Release 12.1(1)E.
|
12.1(2)T
|
This
command was modified to enable low latency queueing (LLQ) on Frame Relay VCs.
|
12.2(14)SX
|
Support
for this command was implemented on Cisco 7600 series routers. Support was
added for output policy maps.
|
12.2(15)BX
|
This
command was implemented on the ESR-PRE2.
|
12.2(17d)SXB
|
This
command was implemented on the Supervisor Engine 2 and integrated into Cisco
IOS Release 12.2(17d)SXB.
|
12.2(33)SRA
|
This
command was integrated into Cisco IOS Release 12.2(33)SRA.
|
12.4(2)T
|
This
command was modified. Support was added for subinterface configuration mode and
for ATM PVC-in-range configuration mode to extend policy map functionality on
an ATM VC to the ATM VC range.
|
12.4(4)T
|
The
type stack
and
type control
keywords were added to support flexible packet matching (FPM).
|
12.2(28)SB
|
This
command was integrated into Cisco IOS Release 12.2(28)SB and implemented on the
Cisco 10000 series router.
|
12.2(31)SB2
|
This
command was integrated into Cisco IOS Release 12.2(31)SB2.
|
12.3(7)XI2
|
This
command was modified to support subinterface configuration mode and ATM
PVC-in-range configuration mode for ATM VCs on the Cisco 10000 series router
and the Cisco 7200 series router.
|
12.2(18)ZY
|
The
type stack
and
type control
keywords were integrated into Cisco IOS Release 12.2(18)ZY on the Catalyst 6500
series of switches equipped with the Programmable Intelligent Services
Accelerator (PISA).
|
12.2(33)SRC
|
Support
for this command was enhanced on Cisco 7600 series routers.
|
12.2(33)SB
|
This
command was modified. The command was implemented on the Cisco 10000 series
router for the PRE3 and PRE4.
|
Cisco
IOS XE Release 2.3
|
This
command was modified to support ATM PVP configuration mode.
|
12.4(18e)
|
This
command was modified to prevent simultaneous configuration of legacy
traffic-shaping and Cisco Modular QoS CLI (MQC) shaping on the same interface.
|
Cisco
IOS XE Release 3.3S
|
This
command was modified to support Ethernet service configuration mode.
|
Cisco
IOS XE Release 3.5S
|
This
command was modified. An error displays if you try to configure the
service-policy
input or
service-policy
output command when the
ip subscriber
interface command is already configured on the interface.
|
15.2(1)S
|
This
command was modified to allow simultaneous nonqueueing policies to be enabled
on subinterfaces.
|
15.2(2)E
|
This command was integrated into Cisco IOS Release 15.2(2)E.
This command is supported in template configuration mode.
|
Cisco IOS XE Release 3.6E
|
This command was integrated into Cisco IOS XE Release 3.6E.
This command is supported in template configuration mode.
|
Usage Guidelines
The table below
shows which configuration mode to choose based on the intended use of the
command.
Table 1. Configuration Modes Based
on Command Application
Application
|
Mode
|
Standalone VC
|
ATM VC
submode
|
ATM VC
bundle members
|
ATM VC
Bundle configuration
|
A range
of ATM PVCs
|
Subinterface configuration
|
Individual PVC within a PVC range
|
ATM
PVC-in-range configuration
|
Frame
Relay VC
|
Static
maps class configuration
|
Ethernet
services, Ethernet VCs (EVCs)
|
Ethernet
service configuration
|
Interface Template
|
Template configuration
|
You can attach a
single policy map to one or more interfaces or to one or more VCs to specify
the service policy for those interfaces or VCs.
A service policy
specifies class-based weighted fair queueing (CBWFQ). The class policies that
make up the policy map are then applied to packets that satisfy the class map
match criteria for the class.
Before you can
attach a policy map to an interface or ATM VC, the aggregate of the configured
minimum bandwidths of the classes that make up the policy map must be less than
or equal to 75 percent (99 percent on the Cisco 10008 router) of the interface
bandwidth or the bandwidth allocated to the VC.
Before you can
enable low latency queueing (LLQ) for Frame Relay (priority queueing
[PQ]/CBWFQ), you must first enable Frame Relay traffic shaping (FRTS) on the
interface using the
frame-relay
traffic-shaping command in interface configuration mode. You then
attach an output service policy to the Frame Relay VC using the
service-policy command in Static maps class
configuration mode.
To attach a
policy map to an interface or ATM VC, the aggregate of the configured minimum
bandwidths of the classes that make up the policy map must be less than or
equal to 75 percent of the interface bandwidth or the bandwidth allocated to
the VC. For a Frame Relay VC, the total amount of bandwidth allocated must not
exceed the minimum committed information rate (CIR) configured for the VC less
any bandwidth reserved by the
frame-relay voice
bandwidth
or
frame-relay ip rtp
priority
Static maps class configuration mode commands. If these values
are not configured, the minimum CIR defaults to half of the CIR.
Configuring CBWFQ
on a physical interface is possible only if the interface is in the default
queueing mode. Serial interfaces at E1 (2.048 Mbps) and below use weighted fair
queueing (WFQ) by default. Other interfaces use first-in first-out (FIFO) by
default. Enabling CBWFQ on a physical interface overrides the default interface
queueing method. Enabling CBWFQ on an ATM permanent virtual circuit (PVC) does
not override the default queueing method.
When you attach a
service policy with CBWFQ enabled to an interface, commands related to fancy
queueing such as those pertaining to fair queueing, custom queueing, priority
queueing, and Weighted Random Early Detection (WRED) are available using the
modular quality of service CLI (MQC). However, you cannot configure these
features directly on the interface until you remove the policy map from the
interface.
Note |
Beginning in
Cisco IOS Release 12.4(18e), you cannot configure the traffic-shape rate and
MQC shaping on the same interface at the same time. You must remove the
traffic-shape rate configured on the interface before you attach the service
policy. For example, if you try to enter the
service-policy {input |
output }
policy-map-name command when the
traffic-shape rate
command is already in effect, this message is displayed:
Remove traffic-shape rate configured on the interface before attaching the service-policy. If the MQC shaper is attached first, and you enter the legacy
traffic-shape
rate command on the same interface, the command is rejected and
an error message is displayed.
|
You can modify a
policy map attached to an interface or VC, changing the bandwidth of any of the
classes that make up the map. Bandwidth changes that you make to an attached
policy map are effective only if the aggregate of the bandwidth amount for all
classes that make up the policy map, including the modified class bandwidth, is
less than or equal to 75 percent of the interface bandwidth or the VC
bandwidth. If the new aggregate bandwidth amount exceeds 75 percent of the
interface bandwidth or VC bandwidth, the policy map is not modified.
After you apply
the
service-policy command to set a class of service
(CoS) bit to an Ethernet interface, the policy remains active as long as there
is a subinterface that is performing 8021.Q or Inter-Switch Link (ISL)
trunking. Upon reload, however, the service policy is removed from the
configuration with the following error message:
Process "set" action associated with class-map voip failed: Set cos supported only with IEEE 802.1Q/ISL interfaces.
Note |
The
service-policy input and
service-policy
output commands cannot be configured if the
ip
subscriber interface command is already configured on the
interface; these commands are mutually exclusive.
|
Simultaneous Nonqueueing
QoS Policies
Beginning in Cisco
IOS Release 15.2(1)S, you can configure simultaneous nonqueueing QoS policies
on an ATM subinterface and ATM PVC, or on a Frame Relay (FR) subinterface and
data-link connection identifier (DLCI). However, simultaneous queueing policies
are still not allowed, because they create hierarchical queueing framework
layer contention. If you try to configure simultaneous queueing policies, the
policies are rejected and the router displays an error message.
Note |
If both the
PVC or DLCI and subinterface policies are applied under the same subinterface,
the policy under the PVC or DLCI takes precedence and the subinterface policy
has no effect.
|
Cisco 10000 Series Router
Usage Guidelines
The Cisco 10000
series router does not support applying CBWFQ policies to unspecified bit rate
(UBR) VCs.
To attach a
policy map to an interface or a VC, the aggregate of the configured minimum
bandwidth of the classes that make up the policy map must be less than or equal
to 99 percent of the interface bandwidth or the bandwidth allocated to the VC.
If you attempt to attach a policy map to an interface when the sum of the
bandwidth assigned to classes is greater than 99 percent of the available
bandwidth, the router logs a warning message and does not allocate the
requested bandwidth to all of the classes. If the policy map is already
attached to other interfaces, it is removed from them.
The total
bandwidth is the speed (rate) of the ATM layer of the physical interface. The
router converts the minimum bandwidth that you specify to the nearest multiple
of 1/255 (ESR-PRE1) or 1/65,535 (ESR-PRE2) of the interface speed. When you
request a value that is not a multiple of 1/255 or 1/65,535, the router chooses
the nearest multiple.
The bandwidth
percentage is based on the interface bandwidth. In a hierarchical policy, the
bandwidth percentage is based on the nearest parent shape rate.
By default, a
minimum bandwidth guaranteed queue has buffers for up to 50 milliseconds of
256-byte packets at line rate, but not less than 32 packets.
For Cisco IOS
Release 12.0(22)S and later releases, to enable LLQ for Frame Relay (priority
queueing (PQ)/CBWFQ) on the Cisco 10000 series router, first create a policy
map and then assign priority to a defined traffic class using the
priority
command. For example, the following sample configuration shows how to configure
a priority queue with a guaranteed bandwidth of 8000 kb/s. In the example, the
Business class in the policy map named “map1” is configured as the priority
queue. The map1 policy also includes the Non-Business class with a minimum
bandwidth guarantee of 48 kb/s. The map1 policy is attached to serial interface
2/0/0 in the outbound direction.
class-map Business
match ip precedence 3
policy-map map1
class Business
priority
police 8000
class Non-Business
bandwidth 48
interface serial 2/0/0
frame-relay encapsulation
service-policy output map1
On the PRE2, you
can use the
service-policy command to attach a QoS policy to
an ATM subinterface or to a PVC. However, on the PRE3, you can attach a QoS
policy only to a PVC.
Cisco 7600 Series
Routers
The
output
keyword is not supported on Cisco 7600 series routers that are configured with
a Supervisor Engine 2.
Do not attach a
service policy to a port that is a member of an EtherChannel.
Although the CLI
allows you to configure QoS based on policy feature cards (PFCs) on the WAN
ports on the OC-12 ATM optical services modules (OSM) and on the WAN ports on
the channelized OSMs, PFC-based QoS is not supported on the WAN ports on these
OSMs. OSMs are not supported on Cisco 7600 series routers that are configured
with a Supervisor Engine 32.
PFC QoS supports
the optional
output
keyword only on VLAN interfaces. You can attach both an input policy map and an
output-policy map to a VLAN interface.
Cisco 10000 Series Routers
Control Policy Maps
Activate a
control policy map by applying it to a context. A control policy map can be
applied to one or more of the following types of contexts, which are listed in
order of precedence:
-
Global
-
Interface
-
Subinterface
-
Virtual
template
-
VC class
-
PVC
In general,
control policy maps that are applied to more specific contexts take precedence
over policy maps applied to more general contexts. In the list, the context
types are numbered in order of precedence. For example, a control policy map
that is applied to a permanent virtual circuit (PVC) takes precedence over a
control policy map that is applied to an interface.
Control policies
apply to all sessions hosted on the context. Only one control policy map can be
applied to a given context.
Abbreviated Form of the
service-policy Command
In Cisco IOS
Release 12.2(33)SB and later releases, the router does not accept the
abbreviated form (ser) of the
service-policy command. Instead, you must spell
out the command name
service-
before the router accepts the command. For example, the following error message
displays when you attempt to use the abbreviated form of the
service-policy command:
interface GigabitEthernet1/1/0
ser out ?
% Unrecognized command
ser ?
% Unrecognized command
As shown in the
following example, when you enter the command as
service-
followed by a space, the router parses the command as
service-policy . Entering the question mark causes
the router to display the command options for the
service-policy command.
service- ?
input Assign policy-map to the input of an interface
output Assign policy-map to the output of an interface
type Configure CPL Service Policy
In releases prior
to Cisco IOS Release 12.2(33)SB, the router accepts the abbreviated form of the
service-policy command. For example, the router
accepts the following commands:
interface GigabitEthernet1/1/0
ser out test
Examples
The following
example shows how to attach a policy map to a Fast Ethernet interface:
interface fastethernet 5/20
service-policy input pmap1
The following
example shows how to attach the service policy map named “policy9” to DLCI 100
on output serial interface 1 and enables LLQ for Frame Relay:
interface Serial1/0.1 point-to-point
frame-relay interface-dlci 100
class fragment
map-class frame-relay fragment
service-policy output policy9
The following
example shows how to attach the service policy map named “policy9” to input
serial interface 1:
interface Serial1
service-policy input policy9
The following
example attaches the service policy map named “policy9” to the input PVC named
“cisco”:
pvc cisco 0/34
service-policy input policy9
vbr-nt 5000 3000 500
precedence 4-7
The following
example shows how to attach the policy named “policy9” to output serial
interface 1 to specify the service policy for the interface and enable CBWFQ on
it:
interface serial1
service-policy output policy9
The following
example attaches the service policy map named “policy9” to the output PVC named
"cisco":
pvc cisco 0/5
service-policy output policy9
vbr-nt 4000 2000 500
precedence 2-3
Examples
The following
example shows how to attach the service policy named “userpolicy” to DLCI 100
on serial subinterface 1/0/0.1 for outbound packets:
interface serial 1/0/0.1 point-to-point
frame-relay interface-dlci 100
service-policy output userpolicy
Note |
You must be
running Cisco IOS Release 12.0(22)S or a later release to attach a policy to a
DLCI in this way. If you are running a release prior to Cisco IOS Release
12.0(22)S, attach the service policy as described in the previous configuration
examples using the legacy Frame Relay commands, as shown in the example “how to
attach the service policy map named “policy9” to DLCI 100 on output serial
interface 1 and enable LLQ for Frame Relay”.
|
The following
example shows how to attach a QoS service policy named “map2” to PVC 0/101 on
the ATM subinterface 3/0/0.1 for inbound traffic:
interface atm 3/0/0
atm pxf queueing
interface atm 3/0/0.1
pvc 0/101
service-policy input map2
Note |
The
atm pxf queueing
command is not supported on the PRE3 or PRE4.
|
The following
example shows how to attach a service policy named “myQoS” to physical Gigabit
Ethernet interface 1/0/0 for inbound traffic. VLAN 4, configured on Gigabit
Ethernet subinterface 1/0/0.3, inherits the service policy of physical Gigabit
Ethernet interface 1/0/0.
interface GigabitEthernet 1/0/0
service-policy input myQoS
interface GigabitEthernet 1/0/0.3
encapsulation dot1q 4
The following
example shows how to apply the policy map named “policy1” to the virtual
template named “virtual-template1” for all inbound traffic. In this example,
the virtual template configuration also includes Challenge Handshake
Authentication Protocol (CHAP) authentication and PPP authorization and
accounting.
interface virtual-template1
ip unnumbered Loopback1
no peer default ip address
ppp authentication chap vpn1
ppp authorization vpn1
ppp accounting vpn1
service-policy input policy1
The following
example shows how to attach the service policy map named “voice” to ATM VC
2/0/0 within a PVC range of a total of three PVCs and enable subinterface
configuration mode where a point-to-point subinterface is created for each PVC
in the range. Each PVC created as part of the range has the voice service
policy attached to it.
configure terminal
interface atm 2/0/0
range pvc 1/50 1/52
service-policy input voice
The following
example shows how to attach the service policy map named “voice” to ATM VC
2/0/0 within a PVC range, where every VC created as part of the range has the
voice service policy attached to it. The exception is PVC 1/51, which is
configured as an individual PVC within the range and has a different service
policy named “data” attached to it in ATM PVC-in-range configuration mode.
configure terminal
interface atm 2/0/0
range pvc 1/50 1/52
service-policy input voice
pvc-in-range 1/51
service-policy input data
The following
example shows how to configure a service group named “PREMIUM-SERVICE” and
apply the input policy named “PREMIUM-MARK-IN” and the output policy named
“PREMIUM-OUT” to the service group:
policy-map type service PREMIUM-SERVICE
service-policy input PREMIUM-MARK-IN
service-policy output PREMIUM-OUT
The following
example shows a policy map and interface configuration that supported
simultaneous nonqueueing policies:
Policy-map p-map
class c-map
set mpls experimental imposition 4
interface ATM1/0/0.1 multipoint
no atm enable-ilmi-trap
xconnect 10.1.1.1 100001 encapsulation mpls
service-policy input p-map
pvc 1/41 l2transport
no epd
!
pvc 1/42 l2transport
no epd
!
pvc 1/43 l2transport
no epd
interface ATM1/0/0.101 multipoint
no atm enable-ilmi-trap
pvc 9/41 l2transport
xconnect 10.1.1.1 1001011 encapsulation mpls
service-policy input p-map
!
pvc 10/41 l2transport
xconnect 10.1.1.1 1001012 encapsulation mpls
!
The following
example shows how to attach simultaneous nonqueueing QoS policies on an ATM
subinterface and ATM PVC:
interface atm 1/0/0.101
pvc 9/41
service-policy input p-map
The following example shows how to enable a builtin autoconfiguration
policy map for an interface template:
Device# configure terminal
Device(config)# template user-template1
Device(config-template)# service-policy type control subscriber BUILTIN_AUTOCONF_POLICY
Device(config-template)# end