Skip to content

Lab 07-01 · Simple queue: put a speed limit on one laptop

MTCNA

Module 7 · QoS. Official course slides 285–290: quality of service, rate limiting, simple queues, the FastTrack warning (slide 288), Torch (slide 289) and the LAB "Simple Queue" (slide 290).

Your little brother starts downloading a 100 GB game. Suddenly your video call freezes, your online match lags and the whole house shouts "who is using the Internet?!". The line is the same as five minutes ago. What changed is that one device is eating almost all of it.

Every café, school and hotel WiFi has this problem, and every one of them solves it the same way: the router gives each device a speed limit. Today you will put one on your own laptop, measure it with real tools, and discover why a brand-new MikroTik router can ignore your limit completely.

What you will learn

  • Explain what QoS and rate limiting are, and why a router can only limit incoming traffic indirectly
  • Create a simple queue with a target and a max-limit for upload and download
  • Explain why the default FastTrack rule must be disabled for queues to work
  • Watch live traffic with Torch
  • Measure the real speed and avoid the ÷8 trap: why a 256k limit downloads at about 32 kB/s

Quality of service in one paragraph

QoS (quality of service) is how well a network serves its users: how fast, how stable, how fair.

RouterOS has several QoS tools. This module uses the most common one: rate limiting (also called shaping), which means not letting some traffic go faster than a chosen speed.

Here is the analogy for the whole lab. The link to the Internet is a motorway and every packet is a car. A queue is a toll gate: it lets cars through at a fixed pace. If cars arrive faster than that, they wait in line (they are queued), and if the line gets too long, the newest ones are turned away (dropped).

flowchart LR
    I["<b>Internet</b><br>sends as fast as it can"] -- "cars arrive<br>at 1 Mbps" --> Q
    subgraph R1["r1 · your router"]
        Q["<b>Queue</b> (toll gate)<br>lets 256k through<br>the rest waits or is dropped"]
    end
    Q -- "256k" --> L["<b>Laptop</b><br>192.168.88.200"]

You cannot stop the cars before they reach the toll

The router cannot control what the Internet sends to it: the data has already travelled down the cable when it arrives. So how can it limit a download? Indirectly: it delays and drops the packets that go over the limit. TCP, the protocol that carries web pages and downloads, notices the missing packets and slows itself down until it fits. The server ends up sending at your limit, because your router taught it to.

Bits, bytes and the ÷8 trap (again)

Speed limits in RouterOS, like Internet contracts, are in bits per second:

Written Means Per second
128k 128 kilobits per second (kbps) 128,000 bits = 16,000 bytes
256k 256 kbps 256,000 bits = 32,000 bytes
1M 1 megabit per second (Mbps) 1,000,000 bits = 125,000 bytes

But your browser and curl show bytes per second. You met this in Unit 1: lowercase b is a bit, uppercase B is a byte, and there are 8 bits in a byte. A 256k limit is 256 ÷ 8 = 32 kB/s. If you see 32 kB/s and think "my limit is broken, I asked for 256", you fell into the ÷8 trap.

Simple queues

A simple queue is a speed limit for one target (an address, a network or an interface), with one value for upload and one for download.

The key fields (WinBox Queues → Simple Queues → +):

Field Meaning Lab value
Name A label for humans laptop
Target Whose traffic: the client's address 192.168.88.200/32
Max Limit The maximum speed: Target Upload / Target Download 128k / 256k

Upload and download are always seen from the target's point of view: upload is what the laptop sends, download is what it receives. In the CLI both go in one field, max-limit=upload/download.

FastTrack: the electronic toll lane

A new MikroTik router comes with a firewall rule called FastTrack (defconf: fasttrack). It marks established connections so that their packets skip most of the router's work: the firewall, connection tracking... and the queues. It is like the electronic toll lane on a motorway: cars with a tag drive straight through and never stop at the gate. Great for speed, terrible for your speed limit.

That is why the course says (slide 288): disable the FastTrack rule so that the simple queue works.

In the virtual lab you will not see the bypass

MikroTik defines FastTrack as "Fast Path + Connection Tracking": it only works when the network card's driver supports RouterOS fast path. The virtual cards of the CHR used in this lab do not, so here ipv4-fasttrack-packets stays at 0 and the queue works even with the rule enabled. On your hAP in class it is different: with FastTrack on, most packets of a download skip the queue and the limit seems to be ignored. Disable it here too: it is part of the lab and the check tests it.

Why are all the speeds in these labs so small?

The virtual routers run the free CHR licence, which caps every port at 1 Mbps of upload. So the "Internet" in the lab gives you about 1 Mbps, never more, and every limit in this module is scaled to fit under it. The course slides use the same small values for this LAB (128k/256k).

The scenario

flowchart LR
    INET["<b>internet</b><br>198.51.100.10<br>web + iperf3 server"]
    CAP["<b>class-ap</b><br>class gateway<br>10.0.0.1 · 198.51.100.1"]
    subgraph R1["r1 · your router"]
        WAN["ether2 (WAN)<br>DHCP client: 10.0.0.x"]
        BR["<b>bridge1</b> (LAN)<br>192.168.88.1/24<br>ports ether3, ether4"]
    end
    PC1["<b>pc1</b> · your laptop<br>192.168.88.200"]
    PC2["<b>pc2</b><br>192.168.88.201"]
    INET ---|"198.51.100.0/24"| CAP
    CAP ---|"10.0.0.0/24"| WAN
    WAN --- BR
    BR ---|"ether3"| PC1
    BR ---|"ether4"| PC2
Node Role Address
internet "The Internet": web server (www.mikrotik.com) and iperf3 speed-test server 198.51.100.10/24
class-ap The trainer's router, class gateway, DNS, NAT 10.0.0.1/24 and 198.51.100.1/24
r1 Your router, factory configuration (with FastTrack) WAN by DHCP, LAN 192.168.88.1/24
pc1 Your laptop (MAC 02:00:00:00:07:01) 192.168.88.200 (static DHCP lease)
pc2 Another device on the LAN (MAC 02:00:00:00:07:02) 192.168.88.201 (static DHCP lease)

The course asks for the laptop at 192.168.XY.200. This lab uses the factory LAN, so XY = 88 and the laptop is 192.168.88.200: a static lease on r1 always gives that address to pc1.

Why ether2 and not ether1?

On a real hAP the Internet port is ether1. In the virtual lab ether1 is reserved for the lab itself (containerlab uses it to manage the router), so the Internet port is ether2 and the LAN ports start at ether3. Never touch ether1 in these labs.

iperf3 is the tool network engineers use to measure speed: a client sends (or receives) as much data as it can to an iperf3 server for a few seconds and reports the rate in bits per second.

Start the lab

Download the lab files and unzip them: 07-01-simple-queue.zip. Open a terminal inside the 07-01-simple-queue folder.

sudo containerlab deploy -t topology.clab.yml

Give RouterOS about two minutes to boot. Then open the router and the laptop in two terminals:

ssh admin@clab-mtcna-07-01-r1            # password: admin
docker exec -it clab-mtcna-07-01-pc1 bash

At any moment you can run ./check.sh (with CLAB_EXEC="docker exec" on your PC) to see which parts are already solved. It measures real speeds, so it takes about a minute.

Step 1 · Measure the speed without limits

You cannot prove a limit works if you do not know the speed before it. On pc1:

ip -br address show eth1                     # expect 192.168.88.200/24
iperf3 -c 198.51.100.10 -R -t 6              # -R = Reverse: the server sends, you download
iperf3 -c 198.51.100.10 -t 6                 # you upload

Look at the last two lines (sender / receiver). Expected: about 1 Mbits/sec both ways (the free CHR licence cap).

Check yourself

  1. Write down your download and upload speed. How many kilobytes per second is that download?

Done when you have both numbers written in your report.

Step 2 · Disable FastTrack

On a factory router, any queue you create would be skipped by fast-tracked packets. Switch the rule off first.

WinBox: IP → Firewall → Filter Rules, select defconf: fasttrack, click the ✗ (disable) button.

/ip firewall filter print
/ip firewall filter disable [find where action=fasttrack-connection]
/ip firewall filter print where action=fasttrack-connection

Expected: the rule is still there, but now with the flag X (disabled). Do not delete it: on a real router you will want to turn it back on when you remove your queues.

Now look at the FastTrack counters:

/ip settings print

In the virtual lab you will see ipv4-fast-path-active: no and ipv4-fasttrack-packets: 0: these virtual cards cannot fast-track at all (see the warning above). On a hAP, the packet counter climbs fast during a download while the rule is enabled.

Check yourself

  1. Using the toll analogy, explain in one sentence why FastTrack and queues do not get along.
  2. FastTrack exists to make the router faster. What do you lose by disabling it?

Done when the FastTrack rule shows the X flag.

Step 3 · Create the simple queue

Now the toll gate. The course asks for upload 128k, download 256k for the laptop.

WinBox: Queues → Simple Queues → +. Name laptop, Target 192.168.88.200, Max Limit: Target Upload 128k, Target Download 256k. OK.

/queue simple add name=laptop target=192.168.88.200/32 max-limit=128k/256k
/queue simple print

Expected: one queue laptop, target=192.168.88.200/32, max-limit=128k/256k.

Upload first, download second

max-limit=128k/256k means upload 128k, download 256k. Swap them and your laptop downloads at 128k. In WinBox the two columns are called Target Upload and Target Download.

Done when the queue is listed without the X or I flags.

Step 4 · Watch it with Torch

Torch is the router's real-time traffic monitor: pick an interface and it shows every flow passing through it right now, with its speed. Start a long download on pc1:

iperf3 -c 198.51.100.10 -R -t 30

While it runs, on r1 (WinBox: Tools → Torch, Interface bridge1, Src. Address 192.168.88.200, Start):

/tool torch interface=bridge1 src-address=192.168.88.200/32

Press Ctrl+C to stop Torch. Expected: one TCP line between 192.168.88.200 and 198.51.100.10 port 5201, with TX around 250 kbps. TX is what the router sends out of bridge1, so towards the laptop: the download. The queue itself also counts:

/queue simple print stats

The rate= field shows upload/download, for example rate=9.6kbps/255.2kbps, and dropped= counts the cars turned away at the gate.

Check yourself

  1. Why does Torch show traffic in both directions (TX and RX) for a download?
  2. The queue has dropped packets, but the download did not fail. Who resends the missing data?

Torch switches FastTrack off while it runs

According to MikroTik's packet-flow documentation, FastTrack cannot work while Torch (or the sniffer) is running. On a real hAP with the FastTrack rule still enabled, the queue would seem to work while you watch with Torch, and stop working when you close it. Always confirm with a measurement taken without Torch, like the curl of the next step.

Done when you have seen the download at about 250 kbps in Torch.

Step 5 · Download "RouterOS" and do the ÷8 maths

The course asks you to download the current RouterOS from www.mikrotik.com/download. In the lab, the web server has a 2 MiB file playing that role. On pc1:

ping -c 2 www.mikrotik.com                      # the name resolves to 198.51.100.10
curl -o /dev/null http://www.mikrotik.com/routeros.npk

curl shows a progress meter. Watch the Average Dload column: about 30k, and the download takes about 67 seconds. That k is kilobytes. Check it:

  • File: 2 MiB = 2,097,152 bytes × 8 = 16,777,216 bits.
  • Limit: 256k = 256,000 bits per second.
  • Time: 16,777,216 ÷ 256,000 ≈ 65.5 s. Speed in bytes: 256,000 ÷ 8 = 32,000 bytes/s.

The real numbers are a little worse because every packet also carries headers (addresses, ports...) that count against the limit but are not part of the file.

Last, prove the limit is only for the laptop. On pc2 (docker exec -it clab-mtcna-07-01-pc2 bash):

iperf3 -c 198.51.100.10 -R -t 6 -p 5202

Expected: about 1 Mbps again. pc2 is not the queue's target.

Check yourself

  1. Without the queue, how long would the same 2 MiB file take at 1 Mbps? Show the calculation.
  2. A friend says "my limit is 256k but curl shows 30k, the router is broken". What do you answer?

Done when your report has the curl time and the calculation. Run ./check.sh: it must say lab mtcna-07-01 solved.

If something goes wrong

Symptom Likely cause Fix
pc1 has no 192.168.88.200 DHCP did not finish while the router was booting On pc1: dhclient -1 eth1
On a real hAP the download ignores the limit FastTrack still enabled IP → Firewall, disable defconf: fasttrack
Download limited to 128k, upload to 256k Values swapped max-limit=upload/download: /queue simple set laptop max-limit=128k/256k
The queue never shows traffic Wrong target (typo, or /24 instead of /32) /queue simple print; fix with set laptop target=192.168.88.200/32
iperf3: error - the server is busy Another test is still running on that port Wait a few seconds, or use the second server -p 5202
Speed in curl is "8 times too slow" The ÷8 trap: curl shows bytes 256 kbps ÷ 8 = 32 kB/s

Clean up

sudo containerlab destroy -t topology.clab.yml --cleanup

Key takeaways

  • QoS is how well a network serves its users; rate limiting is the QoS tool that caps speed.
  • A router limits downloads indirectly: it delays and drops packets, and TCP slows down to fit.
  • A simple queue limits one target; max-limit=upload/download, seen from the target.
  • The factory FastTrack rule lets packets skip the queues: disable it when you use simple queues.
  • Torch shows live traffic per flow; /queue simple print stats shows what the queue is doing.
  • Limits are in bits per second, downloads show bytes: 256k ÷ 8 = 32 kB/s.

Quick check

1. In a simple queue, what does max-limit=128k/256k mean?
  • The target can upload at most 128 kbps and download at most 256 kbps
  • The target can download at most 128 kbps and upload at most 256 kbps
  • The target gets between 128 kbps and 256 kbps in both directions
  • The target can transfer at most 128 kB and 256 kB per second

Max-limit is written upload/download, always from the target's point of view: what the laptop sends is upload, what it receives is download. The values are in bits per second, not bytes.

2. Why does the MTCNA course tell you to disable the FastTrack rule before using simple queues?
  • Fast-tracked packets skip the queues, so the limit would be ignored
  • FastTrack makes the router reject new queues with an error
  • FastTrack changes the laptop's address so the target no longer matches
  • FastTrack only works when the Internet port is ether1

FastTrack sends packets of established connections through a shortcut that bypasses the firewall, connection tracking and simple queues. Like cars in the electronic toll lane, they never stop at the gate.

3. How can a router limit a download if it cannot control what the server sends?
  • It delays and drops the extra packets, and TCP slows down to fit the limit
  • It sends a message to the server asking it to send slower
  • It stores the extra data on its disk and delivers it later
  • It lowers the speed of the Ethernet cable to 256 kbps

Rate limiting of incoming traffic is indirect. Packets over the limit wait in the queue or are dropped; TCP notices the loss and reduces its sending rate until it matches the limit.

4. A queue limits your download to 256k. Roughly what speed will curl show?
  • About 32 kB/s
  • About 256 kB/s
  • About 2 MB/s
  • About 2 kB/s

The ÷8 trap: 256,000 bits per second ÷ 8 = 32,000 bytes per second. Tools like curl and browsers show bytes, so 256k looks like ~32 kB/s (a little less because of headers).

5. What does Torch show?
  • The traffic passing through an interface right now, flow by flow, with its speed
  • The total traffic of the router since it was last rebooted
  • The list of devices that received an address from DHCP
  • The speed test results stored by iperf3 on the laptop

Torch (Tools → Torch) is a real-time traffic monitor. You choose the interface and filters (such as the source address) and it lists each flow with its current TX and RX rate.

6. Which target makes a simple queue apply to just one laptop at 192.168.88.200?
  • 192.168.88.200/32
  • 192.168.88.0/24
  • 192.168.88.1/32
  • 0.0.0.0/0

A /32 prefix means exactly one address. 192.168.88.0/24 would put the whole LAN in the same queue, 192.168.88.1 is the router itself, and 0.0.0.0/0 means any address.

7. You watch a 2 MiB download with a 256k limit and it takes about a minute. Your classmate's identical download takes 17 seconds. Which two explanations fit?
  • Your classmate's laptop is not the target of any queue
  • Your classmate's queue has a higher max-limit, around 1M
  • Your classmate's queue has max-limit 64k
  • Your classmate is downloading a file that is 8 times bigger

2 MiB is about 16.8 million bits. At 256 kbps that takes about 65 s; at 1 Mbps about 17 s. So the classmate is either not limited (the lab Internet gives about 1 Mbps) or limited at a higher max-limit.

Next, you will change this queue so that it no longer limits the laptop everywhere, but only when it talks to one particular server.