EdgeRouter - Advanced-Queue CLI Examples


Overview


In this article readers will see a few examples of configuring and implementing advanced-queue Quality of Service (QoS) in EdgeOS.

WARNING: Using advanced-queue may disable the offload feature at a certain level. The impact will depend on where the root queue is attached to. If attaching root queue to "global", none of flows can be offloaded since almost all flows pass through the global interface. However, if attaching to the ethernet interface, only those flows being sent via that ethernet interface can't be offloaded.

 

NOTES & REQUIREMENTS: 
Applicable to the latest EdgeOS firmware on all EdgeRouter models. Knowledge of the Command Line Interface (CLI) and basic networking knowledge is required. Please see the Related Articles below for more information. Devices used in this article:

Table of Contents


  1. How to Limit the Download/Upload Rate of LAN
  2. How to Limit the Rate for One LAN Device and File-Transfer Application
  3. Tips and Notes
  4. Related Articles

How to Limit the Download/Upload Rate of LAN


Back to Top 

The network topology is shown below and the following interfaces are in use on the EdgeRouter:

  • eth0 (WAN) - 203.0.113.1
  • eth1 (LAN1) - 192.168.1.1/24
  • eth2 (LAN2) - 192.168.2.1/24

advancedqos.001.png

Follow these steps to limit the download/upload rate of LAN2 to 10Mbps Upstream and 30Mbps Downstream using FQ_CODEL (Fair Queueing with Controlled Delay) queuing type for traffic on both directions.

CLI: Access the command line interface. You can do this using the CLI button in the GUI or by using a program such as PuTTY.

1. Enter configuration mode.

configure

2. Create a root queue 1 on "global".

set traffic-control advanced-queue root queue 1 attach-to global
set traffic-control advanced-queue root queue 1 bandwidth 100mbit

3. Create branch queue 100 for upload and queue 200 for download.

set traffic-control advanced-queue branch queue 100 bandwidth 10mbit
set traffic-control advanced-queue branch queue 100 description Upload
set traffic-control advanced-queue branch queue 100 parent 1
set traffic-control advanced-queue branch queue 200 bandwidth 30mbit
set traffic-control advanced-queue branch queue 200 description Download
set traffic-control advanced-queue branch queue 200 parent 1

4. Create filters on root queue 1 to filter upload and download traffic to branch queue 100 and 200.

set traffic-control advanced-queue filters match 100 attach-to 1
set traffic-control advanced-queue filters match 100 description 'WAN upload'
set traffic-control advanced-queue filters match 100 ip source address 192.168.2.0/24
set traffic-control advanced-queue filters match 100 target 100
set traffic-control advanced-queue filters match 200 attach-to 1
set traffic-control advanced-queue filters match 200 description 'WAN download'
set traffic-control advanced-queue filters match 200 ip destination address 192.168.2.0/24
set traffic-control advanced-queue filters match 200 target 200

5. Create FQ_CODEL queue types for later use on leaf queues.

set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN
set traffic-control advanced-queue queue-type fq-codel FQCODEL_UP

6. Create leaf queue 199 to limit default upload traffic and queue 299 to limit default download traffic. Both of the leaf queue use FQ_CODEL as their queueing method.

set traffic-control advanced-queue leaf queue 199 bandwidth 10mbit
set traffic-control advanced-queue leaf queue 199 description default
set traffic-control advanced-queue leaf queue 199 parent 100
set traffic-control advanced-queue leaf queue 199 queue-type FQCODEL_UP
set traffic-control advanced-queue leaf queue 299 bandwidth 30mbit
set traffic-control advanced-queue leaf queue 299 description default
set traffic-control advanced-queue leaf queue 299 parent 200
set traffic-control advanced-queue leaf queue 299 queue-type FQCODEL_DOWN

7. Create a default filter on branch queue 100 to filter traffic to queue 199 and a default filter on branch queue 200 to filter traffic to queue 299.

set traffic-control advanced-queue filters match 199 attach-to 100
set traffic-control advanced-queue filters match 199 description Default
set traffic-control advanced-queue filters match 199 target 199
set traffic-control advanced-queue filters match 299 attach-to 200
set traffic-control advanced-queue filters match 299 description Default
set traffic-control advanced-queue filters match 299 target 299

8. Commit the changes and save the configuration.

commit ; save

How to Limit the Rate for One LAN Device and File-Transfer Application


Back to Top 

The network topology is shown below and the following interfaces are in use on the EdgeRouter:

  • eth0 (WAN) - 203.0.113.1
  • eth1 (LAN1) - 192.168.1.1/24

advancedqos.002.png

Follow these steps to limit the rate for one LAN device and file-transfer application. Use HFQ (Host Fairness Queueing) to explicitly and automatically limit the rate for each of the devices in the configured subnet. Allow burst for file-transfer traffic in a short time. 

CLI: Access the command line interface. You can do this using the CLI button in the GUI or by using a program such as PuTTY.

1. Enter configuration mode.

configure

2. Create a leaf queue 201 and relative filter 201 for limiting download rate 50mbit for LAN IP 192.168.1.9.

set traffic-control advanced-queue leaf queue 201 bandwidth 50mbit
set traffic-control advanced-queue leaf queue 201 description 192.168.1.9
set traffic-control advanced-queue leaf queue 201 parent 200
set traffic-control advanced-queue filters match 201 attach-to 200
set traffic-control advanced-queue filters match 201 description 'limit 192.168.1.9'
set traffic-control advanced-queue filters match 201 ip destination address 192.168.1.9/32
set traffic-control advanced-queue filters match 201 target 201

3. Create leaf queue 101 and relative filter 101 for limiting overall upload file-transfer with rate 5mbit.

set traffic-control advanced-queue leaf queue 101 bandwidth 5mbit
set traffic-control advanced-queue leaf queue 101 description file-transfer
set traffic-control advanced-queue leaf queue 101 parent 100
set traffic-control advanced-queue filters match 101 application category File-Transfer
set traffic-control advanced-queue filters match 101 attach-to 100
set traffic-control advanced-queue filters match 101 description 'limit file-transfer'
set traffic-control advanced-queue filters match 101 target 101

4. Create a HFQ queue-type and replace FQ_CODEL from leaf queue 299 to limit max 10mbit download for each of clients inside the LAN.

set traffic-control advanced-queue queue-type hfq HFQ_DOWN host-identifier dip
set traffic-control advanced-queue queue-type hfq HFQ_DOWN max-rate 10mbit
set traffic-control advanced-queue queue-type hfq HFQ_DOWN subnet 192.168.1.0/24
set traffic-control advanced-queue leaf queue 299 queue-type HFQ_DOWN

5. Allow upload file-transfer to burst data size 50mbit with rate 20mbit.

set traffic-control advanced-queue leaf queue 101 burst burst-rate 50mbit
set traffic-control advanced-queue leaf queue 101 burst burst-size 20mbit

6. Commit the changes and save the configuration.

commit ; save

Tips and Notes


Back to Top

  • Leaf queues can be a direct child of the root queue by just setting the parent of leaf queue as root queue ID.
  • HFQ can support up to /22 subnet.
  • The configuration of advanced-queue is applied in the background and the amount of time spent depends on the complexity of the configuration and can cause varying load times from a few seconds to a couple minutes. Check /var/log/ubnt_daemon to have a clear idea of whether advanced-queue is set.
  • The default queue-type of leaf queue is PFIFO.
  • A filter with no rule will match all packets on the attached queue.
  • Filters attached on the same queue are evaluated by the sequence of its filter ID. Lower ID means the higher priority.
  • Attaching the root queue to the ethernet interface means the queueing policy of descendant queues of the root ONLY apply to packets sent via that ethernet interface. =

Related Articles


Back to Top

Intro to Networking - How to Establish a Connection Using SSH

EdgeRouter - Quality of Service (QoS)


We're sorry to hear that!