QoS (Quality of Service) is a technology that provides various traffic classes with various service priorities. QoS service allows network applications to co-exist in a single network without altering the bandwidth of other applications.

Basic QoS

In basic mode on ESR routers, classification (routing traffic to the queue) and relabeling works only on the input (QoS must be enabled on the interface through which traffic arrives).

Configuration algorithm

Step

Description

Command

Keys

1

Enable QoS on the interface/tunnel/network bridge.

If QoS policy is not assigned on the interface, the interface operates in BasicQoS mode.

esr(config-if-gi)# qos enable


2

Set the trust mode for 802.1p and DSCP codes values in incoming packets (optional).

esr(config)# qos trust <MODE>

<MODE> – trust mode for 802.1p and DSCP codes values, takes one of the following values:

  • dscp – trust mode for DSCP codes values in IP header. Not IP packets will be sent to the default queue.
  • cos – trust mode for 802.1p codes values in 802.1q tag. Untagged packets will be sent to the default queue.
  • cos-dscp – trust mode for DSCP codes values in IP packets and for 802.1p codes values in other packets.

3

Set the match between DSCP codes values of incoming packets and outgoing queues.

The given match works for incoming interfaces/tunnels/bridge on which QoS is enabled (optional).

esr(config)# qos map dscp-queue <DSCP> to <QUEUE>

<DSCP> – service classifier in a packet IP header, takes values in the range of [0..63];

<QUEUE> – queue identifier, takes values in the range of [1..8].

Default values:

  • DSCP: (0-7), queue 1
  • DSCP: (8-15), queue 2
  • DSCP: (16-23), queue 3
  • DSCP: (24-31), queue 4
  • DSCP: (32-39), queue 5
  • DSCP: (40-47), queue 6
  • DSCP: (48-55), queue 7
  • DSCP: (56-63), queue 8

4

Set the match between 802.1p codes values of incoming packets and outgoing queues.

The given match works for incoming interfaces/tunnels/bridge on which QoS is enabled (optional).

esr(config)# qos map cos-queue <COS> to <QUEUE>

<COS> – service classifier in 802.1q packet tag, takes values in the range of [0..7];

<QUEUE> – queue identifier, takes values in the range of [1..8].

Default values:

  • CoS: (0), queue 1
  • CoS: (1), queue 2
  • CoS: (2), queue 3
  • CoS: (3), queue 4
  • CoS: (4), queue 5
  • CoS: (5), queue 6
  • CoS: (6), queue 7
  • CoS: (7), queue 8

5

Set the match between DSCP codes values of incoming packets and outgoing DSCP codes (if remarking is required).

The given match works for incoming interfaces/tunnels/bridge on which QoS is enabled.

esr(config)# qos map dscp-queue <DSCP> to <DSCP>

<DSCP> – service classifier in a packet IP header, takes values in the range of [0..63].

6

Enable DSCP codes changes according to the DSCP-Mutation table (if remarking is required).

esr(config)# qos dscp mutation


7

Set the number of the default queue to which all traffic except IP falls into the trust mode for DSCP priorities.

esr(config)# qos queue default <QUEUE>

<QUEUE> – queue identifier, takes values in the range of [1..8].

8

Set the amount of priority queues. The remaining queues are weighted (optional).

esr(config)# priority-queue out num-of-queues <VALUE>

<VALUE> – amount of queues, takes values of [0..8], where:

  • 0 – all queues take part in WRR (WRR – weight-based queue processing mechanism);
  • 8 – all queues are served as «strictpriority» (strictpriority – priority queue is served as soon as the packets appear).

The priority queues are allocated, starting from the 8th one, decreasing the queue number.

Default value: 8.

9

Define the weights for corresponding weighted queues.

esr(config)# qos wrr-queue <QUEUE> bandwidth <WEIGHT>

<QUEUE> – queue identifier, takes values in the range of [1..8];

<WEIGHT> – weight value, takes values in the range of [1..255].

The default value: weight 1 for all queues.

10

Set the outgoing traffic rate limiting for a certain queue or interface in total.

The command is relevant only for BasicQoS mode of the interface.

If the incoming traffic was classified by advanced QoS, the limiting will not work (if the incoming rate limiting is required).

esr(config-if-gi)# traffic-shape { <BANDWIDTH> [BURST] |
queue <QUEUE><BANDWIDTH> [BURST] }

<QUEUE> – queue identifier, takes values in the range of [1..8].

<BANDWIDTH> – average traffic rate in Kbps, takes the value of [3000..10000000] for TengigabitEthernet interfaces and [64..1000000] for other interfaces and tunnels;

<BURST> – size of the restrictive threshold in KB, takes the value [4..16000]. 128 KB.

Default value: Disabled.

11

Set the incoming traffic rate limiting (if the outgoing rate limiting is required).

esr(config-if-gi)# rate-limit <BANDWIDTH> [BURST]

<BANDWIDTH> – average traffic rate in Kbps, takes the value of [3000..10000000] for TengigabitEthernet interfaces and [64..1000000] for other interfaces and tunnels;

<BURST> – size of the restrictive threshold in KB, takes the value [4..16000]. 128 KB.

Default value: Disabled.

Configuration example

Objective:

Configure the following restrictions on gigabitethernet 1/0/8 interface: transfer DSCP 22 traffic into 8th priority queue, DSCP 14 traffic into 7th weighted queue, limit transfer rate to 60Mbps for 7th queue.

Solution:

In order to make 8th queue a priority queue, and 2nd to 8th queues weighted ones, limit the quantity of priority queues to 1:

esr(config)# priority-queue out num-of-queues 1
CODE

Redirect DSCP 22 traffic into 1st priority queue:

esr(config)# qos map dscp-queue 22 to 8
CODE

Redirect DSCP 14 traffic into 7th priority queue:

esr(config)# qos map dscp-queue 14 to 7
CODE

Enable QoS on the incoming interface to correctly classify traffic and direct it to the appropriate queue on the LAN side:

esr(config)# interface gigabitethernet 1/0/5
esr(config-if-gi)# qos enable
esr(config-if-gi)# exit
CODE

Enable QoS on the WAN side interface for proper queue handling and bandwidth limitation:

esr(config)# interface gigabitethernet 1/0/8
esr(config-if-gi)# qos enable
CODE

Limit transfer rate to 60Mbps for 7th queue:

esr(config-if)# traffic-shape queue 7 60000
esr(config-if)# exit
CODE

To view QoS statistics, use the following command:

esr# show qos statistics gigabitethernet 1/0/8
CODE

Advanced QoS

Configuration algorithm

In advanced mode on ESR routers, classification of incoming traffic is possible on both incoming and outgoing interfaces.

Step

Description

Command

Keys

1

Create access lists to define the traffic to which the advanced QoS should be applied.


See section Access list (ACL) configuration.

2

Create QoS class and switch to the class parameters configuration mode.

esr(config)# class-map <NAME>

<NAME> – name of the class being created, set by the string of up to 31 characters.

3

Specify QoS class description (optional).

esr(config-class-map)# description <description>

<description> – up to 255 characters..

4

Specify the traffic related to the configured class by access control list (ACL).

esr(config-class-map)# match access-group <NAME>

<NAME> – access control list name, set by the string of up to 31 characters.

5

Specify DSCP code value which will be set in IP packets corresponding to the class being configured (cannot be assigned simultaneously with IP Precedence and CoS fields) (if remarking is required).

esr(config-class-map)# set dscp <DSCP>

<DSCP> – DSCP code value, takes values in the range of [0..63].

6

Specify IP Precedence code value which will be set in IP packets corresponding to the class being configured (cannot be assigned simultaneously with DSCP and CoS fields) (if remarking is required).

esr(config-class-map)# set ip-precedence <IPP>

<IPP> – IP Precedence code value, takes values in the range of [0..7].

7

Specify 802.1p priority value which will be set in packets corresponding to the class being configured (cannot be assigned simultaneously with DSCP and IP Precedence fields) (if remarking is required).

esr(config-class-map)# set сos <COS>

<COS>  – priority 802.1p value, takes values of [0..7].

8

Create QoS policy and switch to the policy parameters configuration mode.

esr(config)# policy-map <NAME>

esr(config-policy-map)#

<NAME> – name of the policy being created, set by the string of up to 31 characters.

9

Specify QoS policy description (optional).

esr(config-policy-map)# description <description>

<description> – up to 255 characters..

10

Set the committed outgoing bandwidth for the policy in total.

esr(config-policy-map)# shape average { <BANDWIDTH> | percent <BANDWIDTH_PERCENT> } [BURST]

<BANDWIDTH> – committed bandwidth in Kbps, takes the value of [64..10000000];

<BANDWIDTH_PERCENT> – committed bandwidth in %, calculated from (in order from higher priority to lower priority value):

  • shape average value of the root policy;
  • traffic-shape value on the network interface, bridge, tunnel;
  • speed value of the network interface.

Takes value of [1..100].

<BURST> – size of the restrictive threshold in KB, takes the value [128..16000]. 128 KB.

11

Enable automatic bandwidth allocation between classes without bandwidth configuration, including the default class (if required).

esr(config-policy-map)# shape auto-distribution


12

Include the specified QoS class in the policy and switch to the class parameters configuration mode within the policy.

esr(config-policy-map)# class <NAME>

esr(config-class-policy-map)#

<NAME> – name of the class being bound, set by the string of up to 31 characters. When specifying the 'class-default' value, the incoming unclassified traffic falls into the given class.

13

Include QoS policy in QoS class to create hierarchical QoS.

esr(config-class-policy-map)# service-policy <NAME>

<NAME> – policy name, set by the string of up to 31 characters. Inserted policy must already be created.

14

Set the committed outgoing bandwidth for the class within the policy (if required).

esr(config-class-policy-map)# shape average { <BANDWIDTH> | percent <BANDWIDTH_PERCENT> } [BURST]

<BANDWIDTH> – committed bandwidth in Kbps, takes the value of [64..10000000];

<BANDWIDTH_PERCENT> – committed bandwidth in %, calculated from (in order from higher priority to lower priority value):

  • shape average value of the root policy;
  • traffic-shape value on the network interface, bridge, tunnel;
  • speed value of the network interface.

Takes value of [1..100].

<BURST> – size of the restrictive threshold in KB, takes the value [4..16000]. Default value: 128 KB.

15

Set the shared outgoing bandwidth for a specific class. The class may occupy the bandwidth if a lower priority class has not occupied its committed bandwidth (if required).

esr(config-class-policy-map)# shape peak { <BANDWIDTH> | percent <BANDWIDTH_PERCENT> } [BURST]

16

Specify class operation mode (optional).

esr(config-class-policy-map)# mode <MODE>

<MODE> – class mode:

  • fifo – FIFO mode (First In, First Out);
  • gred – GRED mode (Generalized RED);
  • red – RED mode (Random Early Detection);
  • sfq – SFQ mode (SFQ queue allocates flow-based packets transmission).

Default value: FIFO.

17

Specify the class priority in WRR process (if required).

esr(config-class-policy-map)# priority class <PRIORITY>

<PRIORITY> – priority of class in WRR process, takes values of [1..8].

Classes with the highest priority are proceeded first.

18

Switch the class to the StrictPriority mode and specify the class priority (if required).

esr(config-class-policy-map)# priority level <PRIORITY>

<PRIORITY> – priority level in StrictPriority process, takes values of [1..8].

Classes with the highest priority are proceeded first. The default value: tha class operates in WRR mode, the priority is not specified.

19

Specify the limited number of virtual queues (optional).

esr(config-class-policy-map)# fair-queue <QUEUE-LIMIT>

<QUEUE-LIMIT> – limited number of virtual queues, takes values in the range of [16..4096].

Default value: 16.

20

Specify the limited number of packets for a virtual queue (optional).

esr(config-class-policy-map)# queue-limit <QUEUE-LIMIT>

<QUEUE-LIMIT> – limited number of packets in a virtual queue, takes values in the range of [2..4096].

Default value: 127.

21

Specify RED (Random Early Detection) parameters (if required).

esr(config-class-policy-map)# random-detect <LIMIT> <MIN> <MAX> <APS> <APS-NUM> <PROBABILITY>

<LIMIT> – limited size of a queue in bytes, takes values of in the range of [1..1000000];

<MIN> – minimum size of a queue in bytes, takes value in the range of [1..1000000];

<MAX> – maximum size of a queue in bytes, takes value in the range of [1..1000000];

<APS> – average size of a queue in bytes, takes value in the range of [1..10000000];

<APS-NUM> – number of average size packets allowed for short-term transmission;

<PROBABILITY> – probability of packet drop, takes values of [0..100].

When specifying the values, the following rules should be fulfilled:

  • <MAX>> 2 * <MIN>
  • <LIMIT>> 3 * <MAX>

22

Specify GRED (Generalized Random Early Detection) parameters (if required).

esr(config-class-policy-map)# random-detect queue <QUEUE-NUM>
[ dscp <DSCP> | precedence <IPP> ] <LIMIT> <MIN> <MAX> <APS> <APS-NUM> <PROBABILITY>

<QUEUE-NUM> – queue number [1..16];

<DSCP> – DSCP code value, takes values in the range of [0..63];

<IPP> – IP Precedence code value, takes values in the range of [0..7];

<PRECEDENCE> – IP Precedence value [0..7];

<LIMIT> – limited size of a queue in bytes, takes values of in the range of [1..1000000];

<MIN> – minimum size of a queue in bytes, takes value in the range of [1..1000000];

<MAX> – maximum size of a queue in bytes, takes value in the range of [1..1000000];

<APS> – average size of a queue in bytes, takes value in the range of [1..10000000];

<APS-NUM> – number of average size packets allowed for short-term transmission;

<PROBABILITY> – probability of packet drop, takes values of [0..100].

When specifying the values, the following rules should be fulfilled:

  • <MAX>> 2 * <MIN>
  • <LIMIT>> 3 * <MAX>

23

Enable tcp headers compression protocol for the certain class traffic (if required).

esr(config-class-policy-map)# compression header ip tcp


24

Enable QoS on the interface/tunnel/network bridge.

esr(config-if-gi)# qos enable


25

Define the QoS policy on a configured interface/tunnel/network bridge to classify input and prioritize output traffic.

esr(config-if-gi)# service-policy { input | output } <NAME>

<NAME> – QoS policy name, set by the string of up to 31 characters.

Configuration example

Objective:

Classify incoming traffic by a subnet (10.0.11.0/24, 10.0.12.0/24), label it by DSCP (38 and 42) and segregate by a subnet (40Mbps and 60Mbps), limit general bandwidth to 250Mbps, process the rest of traffic using SFQ mechanism.

Solution:

Configure access control lists for filtering by a subnet, proceed to global configuration mode:

esr(config)# ip access-list extended fl1
esr(config-acl)# rule 1
esr(config-acl-rule)# action permit 
esr(config-acl-rule)# match protocol any
esr(config-acl-rule)# match source-address 10.0.11.0 255.255.255.0
esr(config-acl-rule)# match destination-address any
esr(config-acl-rule)# enable 
esr(config-acl-rule)# exit
esr(config-acl)# exit
esr(config)# ip access-list extended fl2
esr(config-acl)# rule 1
esr(config-acl-rule)# action permit 
esr(config-acl-rule)# match protocol any
esr(config-acl-rule)# match source-address 10.0.12.0 255.255.255.0
esr(config-acl-rule)# match destination-address any
esr(config-acl-rule)# enable 
esr(config-acl-rule)# exit
esr(config-acl)# exit
CODE

Create classes fl1 and fl2, specify the respective access control lists, configure labelling:

esr(config)# class-map fl1
esr(config-class-map)# set dscp 38
esr(config-class-map)# match access-group fl1
esr(config-class-map)# exit
esr(config)# class-map fl2
esr(config-class-map)# set dscp 42
esr(config-class-map)# match access-group fl2
esr(config-class-map)# exit
CODE

Create policy and define general bandwidth limits:

esr(config)# policy-map fl
esr(config-policy-map)# shape average 250000
CODE

Map class to policy, configure bandwidth limit and exit:

esr(config-policy-map)# class fl1
esr(config-class-policy-map)# shape average 40000
esr(config-class-policy-map)# exit
esr(config-policy-map)# class fl2
esr(config-class-policy-map)# shape average 60000
esr(config-class-policy-map)# exit
CODE

To set the bandwidth limit as a percentage, use the shape average percent command.

For the rest of traffic, configure a class with SFQ mode:

esr(config-policy-map)# class class-default 
esr(config-class-policy-map)# mode sfq 
esr(config-class-policy-map)# fair-queue 800
esr(config-class-policy-map)# exit
esr(config-policy-map)# exit
CODE

Enable QoS on the interfaces, policy on gi 1/0/19 interface ingress for classification purposes and gi1/0/20 egress for applying restrictions and SFQ mode for default class:

esr(config)# interface gigabitethernet 1/0/19
esr(config-if-gi)# qos enable 
esr(config-if-gi)# service-policy input fl
esr(config-if-gi)# exit
esr(config)# interface gigabitethernet 1/0/20
esr(config-if-gi)# qos enable 
esr(config-if-gi)# service-policy output fl
esr(config-if-gi)# exit
CODE

To view the statistics, use the following command:

esr# do show qos policy statistics gigabitethernet 1/0/20
CODE