info_i_25x25.png See important information about Ubiquiti Devices and KRACK Vulnerability in this article. We will update this document as more information becomes available.

EdgeRouter - Advanced-queue CLI examples

Overview


In this article readers will learn a few examples of configuring advanced-queue, a new QoS framework since the 1.8.0 release, via CLI.

Note: the advanced-queue MAY disable offload feature, please refer to the Warning section for more information. 

The first example is a basic setting to warm up. The second example has some more advanced parameters, for which settings are provided. There will be some tips of advanced-queue in the end.

The network topology is as below:

WAN - 32.0.1.100/24

LAN - 192.168.1.0/24

WAN speed 30mbps(down) / 10mbps(up) 

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
  4. Warning
  5. Related Articles

How to Limit the Download/Upload Rate of LAN


Back to Top 

Follow these steps to limit the download/upload rate of LAN and use FQ_CODEL (Fair Queueing with Controlled Delay) queuing type for traffic on both directions.

1. 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 40mbit

2. 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

3. 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.1.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.1.0/24
set traffic-control advanced-queue filters match 200 target 200

4. 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

5. 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

6. 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

How to limit the rate for one LAN device and file-transfer application


Back to Top 

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. 

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

set traffic-control advanced-queue leaf queue 201 bandwidth 3mbit
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

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

set traffic-control advanced-queue leaf queue 101 bandwidth 2mbit
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

3. Create a HFQ queue-type and replace FQ_CODEL from leaf queue 299 to limit max 2mbit 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 2mbit
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

4. Allow upload file-transfer to burst data size 15mbit with rate 5mbit

set traffic-control advanced-queue leaf queue 101 burst burst-rate 5mbit
set traffic-control advanced-queue leaf queue 101 burst burst-size 15mbit

Tips


Back to Top 

  • Leaf queues can be a direct child of 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 at background and the amount of time spent depends on the complexity of the configuration, few seconds to couple minutes. Check /var/log/ubnt_daemon to have clear idea of whether advanced-queue is settled.
  • The default queue-type of leaf queue is PFIFO.
  • Filter with no rule means to match all packets on the attached queue.
  • Filters attached on same queue are evaluated by the sequence of its filter ID. Lower ID means the higher priority.
  • Attaching root queue to etherent interface means the queueing policy of decendant queues of the root ONLY apply to packets sent via that ethernet interface. 

Warning


Back to Top 

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

Related Articles


Back to Top 

How to Establish a Connection Using SSH