最新的NetFlow分析仪可以使你在父策略下创建子策略。
配置流量策略,使用policy-map命令。 policy-map命令允许你指定流量策略名,输入policy-map配置模式(启用QoS功能的先决条件,比如流量监控或流量整形)。
关联流量策略和流量分类
使用policy-map命令之后,使用class命令来关联流量分类(在“创建一个流量分类”部分创建)和流量策略。
class命令的语法:
class class-name
no class class-name
对于class-name参数,是你使用class-map命令创建的流量分类名。(“创建一个流量分类”部分第3步).
输入class命令之后,你会进入policy-map class配置模式。policy-map class配置模式用于启用QoS功能。
步骤
要创建一个流量策略并开始一个或者多个QoS功能,执行下面的步骤。
这里列出用于开启一个或者更多QoS功能的命令。例如,开启Class-Based Weighted Fair Queuing (CBWFQ),您需要用bandwidth命令。不是所有QoS功能在所有平台上或者所有Cisco IOS版本上都有效。您可以使用的功能或者命令,请参考您正在使用的平台以及Cisco IOS的版本。 |
|
命令或动作 |
目的 |
Step 1 |
Router> enable |
Enables privileged EXEC mode. |
Step 2 |
Router# configure terminal |
Enters global configuration mode. |
Step 3 |
Router(config)# policy-map policy-name |
Creates or specifies the name of the traffic policy and enters policy-map configuration mode. |
Step 4 |
Router(config-pmap)# class {class-name |class-default} |
Specifies the name of a traffic class (previously created in the "Creating a Traffic Class" section) and enters policy-map class configuration mode. |
|
Use one or more of the following commands to enable the specific QoS feature you want to use. |
|
Step 5 |
Router(config-pmap-c)# bandwidth {bandwidth-kbps | percent percent } |
(Optional) Specifies a minimum bandwidth guarantee to a traffic class in periods of congestion. A minimum bandwidth guarantee can be specified in kbps or by a percentage of the overall available bandwidth. |
Step 6 |
Router(config-pmap-c)# fair-queue number-of-queues |
(Optional) Specifies the number of queues to be reserved for a traffic class. |
Step 7 |
Router (config-pmap-c)# police bps [burst-normal][burst-max] conform-actionaction exceed-actionaction [violate-action action] |
(Optional) Configures traffic policing. |
Step 8 |
Router(config-pmap-c)# priority{bandwidth-kbps | percent percentage} [burst] |
(Optional) Gives priority to a class of traffic belonging to a policy map. |
Step 9 |
Router(config-pmap-c)# queue-limit number-of-packets |
(Optional) Specifies or modifies the maximum number of packets the queue can hold for a class configured in a policy map. |
Step 10 |
Router(config-pmap-c)# random-detect [dscp-based | prec-based] |
(Optional) Enables Weighted Random Early Detection (WRED) or distributed WRED (DWRED). |
Step 11 |
Router(config-pmap-c)# set atm-clp |
(Optional) Sets the cell loss priority (CLP) bit when a policy map is configured. |
Step 12 |
Router(config-pmap-c)# set cos{cos-value | from-field [table table-map-name]} |
(Optional) Sets the Layer 2 class of service (CoS) value of an outgoing packet. |
Step 13 |
Router(config-pmap-c)# set discard-class value |
(Optional) Marks a packet with a discard-class value. |
Step 14 |
Router(config-pmap-c)# set [ip] dscp {dscp-value | from-field [table table-map-name]} |
(Optional) Marks a packet by setting the differentiated services code point (DSCP) value in the type of service (ToS) byte. |
Step 15 |
Router(config-pmap-c)# set fr-de |
(Optional) Changes the discard eligible (DE) bit setting in the address field of a Frame Relay frame to 1 for all traffic leaving an interface. |
Step 16 |
Router(config-pmap-c)# set precedence{precedence-value | from-field [table table-map-name]} |
(Optional) Sets the precedence value in the packet header. |
Step 17 |
Route(config-pmap-c)# set mpls experimental value |
(Optional) Designates the value to which the MPLS bits are set if the packets match the specified policy map. |
Step 18 |
Router (config-pmap-c)# set qos-group{group-id | from-field [table table-map-name]} |
(Optional) Sets a QoS group identifier (ID) that can be used later to classify packets. |
Step 19 |
Router(config-pmap-c)# service-policy policy-map-name |
(Optional) Specifies the name of a traffic policy used as a matching criterion (for nesting traffic policies [hierarchical traffic policies] within one another). |
Step 20 |
Router(config-pmap-c)# shape {average | peak } mean-rate [burst-size [excess-burst-size ]] |
(Optional) Shapes traffic to the indicated bit rate according to the algorithm specified. |
Step 21 |
Router(config-pmap-c)# exit |
(Optional) Exits policy-map class configuration mode. |
流量策略可以嵌套在其他的流量策略里,使用service-policy命令,称为分层流量策略。包含其他策略的成为父策略,而被包含的则称之为子策略。
配置父-子关系策略的配置示例
Router(config)# policy-map child
Router(config-pmap)# class voice
Router(config-pmap-c)# priority 50
Router(config)# policy-map parent
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average 10000000
Router(config-pmap-c)# service-policy child
Router(config-pmap-c)# exit