EdgeRouter - Quality of Service (QoS)
Overview
Readers will learn about the different types of Quality of Service (QoS) Traffic Policies supported by EdgeOS.
Table of Contents
Introduction
Example network demonstrating the directions in which different QoS policies can be applied, egress (out) and ingress (in).
EdgeOS can use various QoS (Quality of Service) policies are to limit traffic in different ways. The policies are applied in the egress (out) or ingress (in) direction on an interface (depending on which direction is supported). In the example above, the EdgeRouter is configured with two interfaces, WAN (eth0) and LAN (eth1). QoS policies can be applied to either of these two interfaces in different directions, depending on the manner in which traffic should be limited. See the section below for more information on the supported directions for the different QoS policies.
Configuring Ingress and Egress Policies
There are many different types of QoS Traffic Policies, each with its different use and limitations. Policies can only be applied in a single direction. Several of the policies supported by EdgeOS that can be applied in the egress (out) direction are:
-
Tail Drop (FIFO)
Queues and drops packets based on a First In / First Out (FIFO) approach. -
Random Early Detection (RED)
Queues and drops packets based on random probability. -
Rate Control
Limits traffic to a pre-defined rate. -
Fair Queue
Queues and transfers packets based on the Stochastic Fairness Queuing approach. -
Shaper
Buffers and transfers packets based on a pre-defined bitrate.
The policy supported by EdgeOS that can be applied in the ingress (in) direction is:
-
Limiter
Drops incoming packets that do not conform to the pre-defined policy.
When using Tail Drop queuing, new packets will be dropped when the queue size reaches the pre-defined limit. The queue does not distinguish between different types of traffic and is configured with a single parameter, the maximum queue size (limit). Follow the steps below to create a Tail Drop (FIFO) policy:
1. Enter configuration mode.
configure
2. Define the policy name and specify the maximum queue size size in packets.
set traffic-policy drop-tail <name> queue-limit 100
3. Attach the policy to an interface in the egress (out) direction.
set interfaces ethernet eth0 traffic-policy out <name>
4. Commit the changes and save the configuration.
commit ; save
When using Random Early Detection (RED), new packets will be dropped at random when the queue starts to increase in size. When the queue is empty, new packets will be accepted and forwarded. As the queue starts to grow in size, the probability for dropping incoming packets will grow as well. Like the Drop Tail queuing, RED does not distinguish between traffic types.
The following options are available when configuring RED:
-
precedence
RED can use different limits for each IP precedence value. -
mark-probability
The probability (1 / N) at which the packets will be dropped. -
minimum-threshold
Queue size at which RED will start dropping packets. -
maximum-threshold
RED will drop packets packets at an increasing rate as the queue length increases.
Follow the steps below to create a RED policy:
1. Enter configuration mode.
configure
2. Define the policy name, precedence value and thresholds.
set traffic-policy random-detect <name> precedence 0 mark-probability 25
set traffic-policy random-detect <name> precedence 0 maximum-threshold 100
set traffic-policy random-detect <name> precedence 0 minimum-threshold 50
3. Attach the policy to an interface in the egress (out) direction.
set interfaces ethernet eth0 traffic-policy out <name>
4. Commit the changes and save the configuration.
commit ; save
When using Rate Control, the traffic is limited to a pre-defined rate. Like the Drop Tail and RED queuing, Rate Control does not distinguish between traffic types. Follow the steps below to create a Rate Control policy:
1. Enter configuration mode.
configure
2. Define the policy name and specify the maximum queue size size in packets.
set traffic-policy rate-control <name> bandwidth 20mbit
3. Attach the policy to an interface in the egress (out) direction.
set interfaces ethernet eth0 traffic-policy out <name>
4. Commit the changes and save the configuration.
commit ; save
The Fair Queue policy uses the Stochastic Fairness Queuing approach to separate traffic flows into different buckets and have the router service each bucket one by one. The separation is done using a hash of the source/destination IP addresses and the source port. Since the fairness is probabilistic, in some cases multiple flows may be put into the same bucket; this can potentially cause unfairness. To minimize effects, you can adjust the hash interval parameter to change the hashing algorithm at fixed time intervals. Follow the steps below to create a Fair Queuing policy:
1. Enter configuration mode.
configure
2. Define the policy name and specify the hash interval.
set traffic-policy fair-queue <name> hash-interval 10
3. Attach the policy to an interface in the egress (out) direction.
set interfaces ethernet eth0 traffic-policy out <name>
4. Commit the changes and save the configuration.
commit ; save
With a Shaping QoS policy, the traffic is buffered to conform to a certain bitrate. Shaping uses the Hierarchical Token Bucket technique and the policy can be customized to provide different bandwidth guarantees to different traffic classes.
Some of the options that are available when configuring Shaping are:
-
class
Match on a certain traffic type (for example a DSCP value). -
queue-type
Can be either set to Fair Queue, Tail Drop, RED or Priority queuing. -
bandwidth
The guaranteed bandwidth set as a flat rate or percentage. -
ceiling
The bandwidth limit set as a flat rate or percentage.
Follow the steps below to create a Shaping policy:
1. Enter configuration mode.
configure
2. Define the policy name and specify the maximum queue size size in packets.
set traffic-policy shaper <name> bandwidth 100mbit
set traffic-policy shaper <name> default bandwidth 75%
set traffic-policy shaper <name> class <nr> bandwidth 25%
set traffic-policy shaper <name> class <nr> match <name> ip dscp 46
3. Attach the policy to an interface in the egress (out) direction.
set interfaces ethernet eth0 traffic-policy out <name>
4. Commit the changes and save the configuration.
commit ; save
The Limiter policy is used to drop incoming packets that do not conform to the policy. The policy can be customized to match on different traffic types (classes) and limit each class individually. Follow the steps below to create a Limiter policy:
1. Enter configuration mode.
configure
2. Define the policy name and specify the classes and bandwidth limits.
set traffic-policy limiter <name> class <nr> bandwidth 1mbit
set traffic-policy limiter <name> class <nr> match <name> ip protocol icmp
set traffic-policy limiter <name> default bandwidth 20mbit
3. Attach the policy to an interface in the ingress (in) direction.
set interfaces ethernet eth1 traffic-policy in <name>
4. Commit the changes and save the configuration.
commit ; save
Configuring the Smart Queue
Smart Queue QoS policy applied on the WAN interface (eth0), limiting the traffic of the LAN hosts to a pre-defined rate.
Starting from the v1.7.0 EdgeOS firmware release, there is another available QoS feature that can be used to limit traffic on the WAN interface. The Smart Queue is designed to allow you to easily limit upload and download speeds to a pre-defined rate. The most common option used with the Smart Queue feature are:
-
WAN Interface
The WAN interface of the router. -
Upload Rate
Specify the upload rate in either Mbit/s, Kbit/s or bit/s. -
Download Rate
Specify the upload rate in either Mbit/s, Kbit/s or bits/s.
Follow the steps below to configure the Smart Queue:
1. Navigate to the Smart Queue tab in the QoS section.
QoS > Smart Queue
2. Specify the policy name, WAN interface (eth0) and the upload and download rate (100/20 Mbit/s in this example).
Policy name: <name>
WAN Interface: eth0
Upload Rate: 20 Mbit/sec
Download Rate: 100 Mbit/sec
3. Apply the changes.
The above configuration can also be set using the CLI:
1. Enter configuration mode.
configure
2. Define the policy name and specify the upload and download rate.
set traffic-control smart-queue <name> wan-interface eth0
set traffic-control smart-queue <name> upload rate 20mbit
set traffic-control smart-queue <name> download rate 1000mbit
3. Commit the changes and save the configuration.
commit ; save
Related Articles
EdgeRouter - Quality of Service (QoS) Shaper for Upload/Download and VoIP
EdgeRouter - Quality of Service (QoS) Advanced Queue
EdgeRouter - Hardware Offloading