Skip to content

Lab 07-02 · Limit the traffic to one server, not one client

MTCNA

Module 7 · QoS. Official course slides 291–292: limiting the traffic to a server instead of a client (target any + Dst.) and the LAB "Simple Queue" (slide 292).

Your school wants students to keep using the Internet at full speed for homework, but one streaming site is eating the whole connection every lunch break. Blocking it would cause a riot. Limiting every student would punish the ones doing homework. What the school really wants is: anybody can use that one site, but slowly.

In Lab 07-01 you limited who (one laptop). Today you will limit where to (one server), for everybody, and prove with a second server that the rest of the Internet stays fast.

What you will learn

  • Find a server's IP address from its name with ping
  • Use a simple queue's Dst. field to limit only the traffic to and from one server
  • Set the target to any (0.0.0.0/0) so the limit applies to every client
  • Prove with measurements that other servers are not limited
  • Explain why a queue that limits "everybody to one server" is shared by all of them

From "who" to "where to"

The target of a simple queue says whose traffic is limited; the Dst. (destination) field says towards which address. A packet goes through the queue only if it matches both.

Back to the motorway from Lab 07-01. Until now the toll gate stopped one car (your laptop) wherever it went. Now the gate stands on the exit to one town (the server): every car taking that exit pays, every other car drives on.

Queue Target Dst. What it limits
Lab 07-01 192.168.88.200/32 (empty = anywhere) The laptop, whatever it talks to
This lab any (0.0.0.0/0) 198.51.100.10/32 Every client, but only with www.mikrotik.com
flowchart LR
    subgraph LAN["LAN 192.168.88.0/24"]
        PC1["<b>pc1</b><br>.200"]
        PC2["<b>pc2</b><br>.201"]
    end
    subgraph R1["r1"]
        Q["<b>Queue mikrotik-com</b><br>target: any<br>dst: 198.51.100.10<br>128k up / 256k down"]
    end
    PC1 --> Q
    PC2 --> Q
    Q -- "limited" --> S1["<b>www.mikrotik.com</b><br>198.51.100.10"]
    PC1 -. "not limited" .-> S2["<b>other server</b><br>198.51.100.20"]

Upload and download keep their meaning

Even with the target set to any, max-limit=128k/256k still reads upload/download from the client's side: 128k for what the clients send to the server, 256k for what they receive from it.

One gate for everybody

A single simple queue is one toll gate. If pc1 and pc2 both download from www.mikrotik.com at the same time, they share the 256k between them; they do not get 256k each. Giving every client its own equal limit is what PCQ does (Lab 07-05).

The scenario

The lab starts where Lab 07-01 ended: FastTrack disabled and a queue laptop that limits pc1 to 128k/256k everywhere. The internet node now answers on two addresses: 198.51.100.10 (www.mikrotik.com) and 198.51.100.20 (an "other server" with no name).

flowchart LR
    INET["<b>internet</b><br>198.51.100.10 = www.mikrotik.com<br>198.51.100.20 = other server"]
    CAP["<b>class-ap</b><br>10.0.0.1 · 198.51.100.1"]
    subgraph R1["r1 · your router"]
        WAN["ether2 (WAN)<br>10.0.0.x"]
        BR["<b>bridge1</b><br>192.168.88.1/24"]
    end
    PC1["<b>pc1</b> · 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 Web + iperf3 servers (ports 5201 and 5202) 198.51.100.10 and 198.51.100.20
class-ap Class gateway, DNS (www.mikrotik.com → 198.51.100.10), NAT 10.0.0.1/24, 198.51.100.1/24
r1 Your router: the solution of Lab 07-01 WAN by DHCP, LAN 192.168.88.1/24
pc1 Your laptop 192.168.88.200
pc2 Another device on the LAN 192.168.88.201

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.

The free CHR licence caps every virtual port at about 1 Mbps, so "full speed" in this lab means about 1 Mbps.

Start the lab

Download the lab files and unzip them: 07-02-queue-to-server.zip. Open a terminal inside the 07-02-queue-to-server folder.

sudo containerlab deploy -t topology.clab.yml

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

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

./check.sh (with CLAB_EXEC="docker exec") tells you at any moment what is already solved.

Step 1 · Find the server's address

A queue works with addresses, not names. The course says: with the ping tool, find out the address of www.mikrotik.com. On pc1:

ping -c 2 www.mikrotik.com

Expected: PING www.mikrotik.com (198.51.100.10). The router asked its DNS server (class-ap) and got the address. WinBox users can do the same in Tools → Ping.

Check yourself

  1. Real websites often have several addresses that change over time. Why is that a problem for a queue that uses Dst.?

Done when you know the address: 198.51.100.10.

Step 2 · Measure both servers with the old queue

Before changing anything, see what the Lab 07-01 queue does to both servers. On pc1:

iperf3 -c 198.51.100.10 -R -t 6              # www.mikrotik.com
iperf3 -c 198.51.100.20 -R -t 6 -p 5202      # the other server

Expected: both around 175–250 kbps. The laptop queue limits pc1 whatever it talks to.

Done when you have both numbers in your report.

Step 3 · Point the queue at the server

The course says: modify the existing simple queue to limit the connection to the mikrotik.com server. Two changes: target becomes any, and Dst. becomes the server.

WinBox: Queues → Simple Queues, double-click laptop. Name mikrotik-com. In Target, remove the laptop address (empty means any). In Dst., type 198.51.100.10. OK.

/queue simple set laptop name=mikrotik-com target=0.0.0.0/0 dst=198.51.100.10/32
/queue simple print

Expected: name="mikrotik-com" target="" dst=198.51.100.10/32 ... max-limit=128k/256k. RouterOS shows 0.0.0.0/0 as an empty target: any address.

Dst. is not a second target

Do not put the server in Target and leave Dst. empty. Then the router would treat the server as the client: its "upload" would be your download, and the two limits would be swapped.

Check yourself

  1. Why did we rename the queue? What would a teammate think, a month later, if it were still called laptop?

Done when the queue shows dst=198.51.100.10/32 and an empty target.

Step 4 · Prove that only one server is limited

Run the same two tests again on pc1:

iperf3 -c 198.51.100.10 -R -t 6              # www.mikrotik.com: limited
iperf3 -c 198.51.100.20 -R -t 6 -p 5202      # other server: free

Expected: about 175–250 kbps from 198.51.100.10 and about 900–1,000 kbps from 198.51.100.20. Then the course's download, watching the speed:

curl -o /dev/null http://www.mikrotik.com/routeros.npk

About 30 kB/s (256k ÷ 8 = 32 kB/s, minus headers). Now pc2, which the old queue never touched (docker exec -it clab-mtcna-07-02-pc2 bash):

iperf3 -c 198.51.100.10 -R -t 6

Also limited: the target is any, so every client is caught at that exit. While a test runs you can watch it on r1 with /tool torch interface=ether2 src-address=198.51.100.10/32 (Ctrl+C to stop) and with /queue simple print stats.

Check yourself

  1. Fill in a table: client (pc1, pc2) × server (.10, .20) → measured speed. Which cells are limited, and why?
  2. If pc1 and pc2 download from www.mikrotik.com at the same moment, how much does each one get? Try it (use -p 5201 on one and -p 5202 on the other).

Done when .10 is limited for both PCs and .20 is not. Run ./check.sh: it must say lab mtcna-07-02 solved.

If something goes wrong

Symptom Likely cause Fix
Both servers still limited The target is still 192.168.88.200/32 and dst is empty /queue simple set mikrotik-com target=0.0.0.0/0 dst=198.51.100.10/32
Nothing is limited any more Wrong address in Dst. (typo, or .20) /queue simple print; fix the dst
Upload and download limits look swapped The server address was put in Target instead of Dst. Target any, Dst. = server
invalid value for argument dst You tried dst="" to clear it Use !dst to unset: /queue simple set mikrotik-com !dst
ping www.mikrotik.com fails pc1 has no DNS (no DHCP lease) On pc1: dhclient -1 eth1
iperf3: the server is busy Another test on the same port Use the other port (-p 5202) or wait

Clean up

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

Key takeaways

  • A simple queue matches target (whose traffic) and Dst. (towards which address).
  • Target any (0.0.0.0/0, shown empty) + Dst. = server limits every client, but only with that server.
  • max-limit=upload/download is still read from the client's side.
  • One simple queue is one gate: all matching clients share its limit.
  • Always measure before and after, and compare with something that should not change.

Quick check

1. Which queue limits every LAN client, but only while talking to 198.51.100.10?
  • target=0.0.0.0/0 dst=198.51.100.10/32
  • target=198.51.100.10/32 with no dst
  • target=192.168.88.200/32 dst=198.51.100.10/32
  • target=192.168.88.0/24 dst=0.0.0.0/0

Target any catches every client and Dst. narrows it to one server. Putting the server in target confuses upload and download; target .200 catches only one laptop; dst any limits all destinations.

2. How did you find the address to put in Dst.?
  • With ping, which asks DNS to turn the name into an address
  • With Torch, which lists every website on the Internet
  • From the DHCP leases on the router
  • From the router's ARP table

ping www.mikrotik.com first asks DNS for the name's address and prints it: 198.51.100.10. DHCP leases and ARP only know devices on your own LAN.

3. With the queue mikrotik-com (256k download), pc1 and pc2 download from www.mikrotik.com at the same time. What happens?
  • They share the 256k between them
  • Each one gets its own 256k
  • The first one gets 256k and the second one gets nothing
  • The queue stops working when two clients use it

A simple queue is one gate with one limit. All the traffic that matches it, from any client, has to fit into those 256k. Equal per-client limits need PCQ.

4. After the change, why does pc1 still download at full speed from 198.51.100.20?
  • Its traffic does not match the queue's Dst., so it never enters the queue
  • The queue only works for names, and .20 has no name
  • The other server is on a different motorway that the router does not see
  • Port 5202 is never limited by simple queues

A packet enters a simple queue only if it matches target and Dst.. Packets to or from .20 do not match dst=198.51.100.10/32, so they pass without any limit.

5. With target any and dst 198.51.100.10, what does max-limit=128k/256k mean?
  • Clients can send 128k to the server and receive 256k from it
  • The server can send 128k to the clients and receive 256k from them
  • Every client gets 128k to 256k from any server
  • The server can use 128k and the router 256k

Upload/download are always from the side of the target (the clients): upload is what they send to the server, download is what they receive from it.

6. A school limits a video site with target any + Dst. One month later the limit stops working, although nobody touched the router. What is the most likely reason?
  • The site's servers now use different IP addresses
  • Simple queues expire after 30 days
  • The students' laptops got new MAC addresses
  • The DHCP pool ran out of addresses

Dst. is an IP address, not a name. Big sites use many addresses and change them; the queue keeps matching the old one. That is why we checked the address with ping first.

Next, you will see how to guarantee a minimum speed to each client, not just cap the maximum.