QoS rules cap how much download and upload chosen traffic may use. Each rule says:
- who: any device, chosen devices, or networks;
- to what: anywhere, an app or a category of apps, addresses, domains, or countries;
- where: through every internet connection (WAN) or one;
- how much: a download limit, an upload limit, or both, in Mbit/s;
- when: always, daily, weekly, one time, or on any schedule you already have;
- shared or per device: one limit for everything the rule matches, or the full limit for each device.
The first rule that matches a connection decides its limit. A QoS rule only slows traffic down; it never lets through anything your firewall rules block.
The example:
| Firewall | fw-main, internet on enp1s0 (shaped at 180 Mbit/s down, 18 Mbit/s up) |
| Networks | zone lan (enp2s0), zone guest (enp2s0.30, Wi-Fi Guest) |
| Rule 1 | the children's two tablets: 5 Mbit/s down each, school nights 21:00 to 07:00 |
| Rule 2 | the guest Wi-Fi: 50 Mbit/s down and 5 Mbit/s up together, to streaming apps |
| Rule 3 | game downloads from Steam: at most 60 Mbit/s for the whole house |
| Rule 4 | the backup to the office (198.51.100.0/24): at most 10 Mbit/s up |
Before you start
- Open Network › Traffic shaping & apps › QoS & traffic shaping and turn the add-in on (the On box at the top of the page, or under System › Add-ins).
- Shape the internet link first (recommended). Under Shaped internet links, press Shape a link and add the WAN with about 90-95 % of what a speed test measures. A QoS rule's limit must be below these speeds, or it would never limit.

- For app and category targets, turn on the App-ID add-in. When you save a rule, Korthveil adds the apps you chose to App-ID's address sets, so App-ID starts learning their servers. A rule matches an app once App-ID has seen its servers (usually after the first use).
- For country targets, the IP database must be loaded (Firewall › Geo filter shows its state).
- For devices, the device should be known in Network › Devices (from DHCP, a reservation, or traffic). A device picked by MAC address is matched on all its IPv4 and IPv6 addresses, and the list is kept current every 30 seconds.
Create a rule
On Network › Traffic shaping & apps › QoS & traffic shaping, under QoS rules, select Create rule. The new rule opens below the list. Every rule is one line in the list; click a rule to open it, and Close (or click the line again) to fold it.

- Name: for example Kids tablets.
- Source:
- Any: every device in your internal zones;
- Device: pick devices from the list (Network › Devices), or type a MAC address or an IP address;
- Network: tick zones, and/or type subnets such as
192.168.30.0/24orfd00:30::/64.
- Target:
- Any: everything on the internet;
- App: choose Specific app (Steam, Netflix, YouTube…) or Category (streaming-media, gaming, file-sharing…);
- IP: addresses or networks, IPv4 and IPv6;
- Domain: host names such as
dl.example.com. The firewall resolves them and matches their addresses; - Region: country codes such as
US,DE,JP.
- Interface: All WANs, or one internet connection.
- Limit applies:
- Shared by all: everything the rule matches shares the limit. Traffic above it waits in a queue, so it stays smooth;
- Per device: each device gets the full limit. Traffic above it is dropped, and the device's connections slow down to fit.
- Download limit and Upload limit: tick one or both and enter Mbit/s.
-
Schedule:
- Always;
- Daily: a time window every day (an end before the start runs past midnight);
- Weekly: days and a time window;
- One Time: a start and an end date and time;
- Custom: any schedule from Firewall › Aliases & objects › Schedules.
Daily, Weekly and One Time are kept as a schedule named
qos-<rule name>, so you also see them in Firewall › Aliases & objects › Schedules. They are removed when no rule uses them.
-
Select Save to pending changes, review, and commit.

Use the arrows in an open rule to change the order: put specific rules (one device, one app) above general ones. A rule with the same source, target, interface and schedule as an earlier one never applies; Korthveil warns about it.
The example rules
| Rule | Source | Target | Interface | Limit | Applies | Schedule |
|---|---|---|---|---|---|---|
| Kids tablets | Device: the two tablets | Any | All WANs | Download 5 | Per device | Weekly: Sun-Thu, 21:00 to 07:00 |
| Guest streaming | Network: guest | App › Category: streaming-media | enp1s0 | Download 50, upload 5 | Shared by all | Always |
| Steam | Any | App › Specific app: steam | All WANs | Download 60 | Shared by all | Always |
| Office backup | Any | IP: 198.51.100.0/24, 2001:db8:99::/48 | All WANs | Upload 10 | Shared by all | Always |
Check that it works
- The Live panel at the bottom of Network › Traffic shaping & apps › QoS & traffic shaping lists the Active QoS rules after the commit, with their limits and, for devices chosen by MAC, the addresses found. "not seen yet" means the device is not in Network › Devices yet.

- From a limited device, run a speed test: the download should settle at the limit (a little below it for per-device limits).
- A schedule's end applies to downloads that are already running at their next packet; no need to restart anything.
- For support, on the firewall itself:
tc -s class show dev ifb-qosdnshows each shared download limit with its bytes and drops,ifb-qosupthe upload limits.
How it works
- Korthveil marks each connection that leaves through a WAN with the number of the first rule that matches it, after routing, so it knows the WAN and still sees the device's own address.
- Shared limits: the marked packets of a connection pass a queue for the rule,
ifb-qosuptoward the internet andifb-qosdntoward your devices, with the rule's speed. Then they continue as before, through the shaped link's CAKE. One queue per direction keeps a shared limit exact over all LAN ports and all WANs. - Per-device limits: each device's packets for the rule are counted against its own rate, by its address; above the rate they are dropped.
- Traffic that no rule matches never passes these queues. LAN-to-LAN traffic and traffic to the firewall are never limited.
- Every match works for IPv4 and IPv6.
Good to know
- A rule needs at least one limit, and each limit must be at least 0.064 Mbit/s and below the shaped speed of the WAN(s) it applies to.
- Up to 64 enabled QoS rules.
- App and Domain targets match the servers learned or resolved so far. Sites behind large CDNs share addresses with other sites, so a domain limit can also slow another site on the same CDN.
- Internet connections are the interfaces with source NAT (masquerade). The firewall's own downloads (updates) are not limited.
- Turning a rule off keeps it; removing it removes its schedule if nothing else uses it.