Rate Limits
Bandix can cap the WAN upload and download speed of devices. There are two mechanisms:
- Schedule rules: per-device limits that apply during chosen time slots on chosen days of the week.
- Global rate limit: one default limit applied to every device, with a whitelist of exempt devices.
Limits are enforced by the backend's eBPF programs. They only apply to traffic between a device and the WAN; traffic between LAN devices is never limited. The Status page reminds you of this with the notice "Rate limiting only applies to WAN traffic."
Units
All limits are stored in bytes per second. The forms let you enter a number and pick a unit:
| Unit | Multiplier (bytes/s) |
|---|---|
| KiB/s | 1024 |
| MiB/s | 1048576 |
| GiB/s | 1073741824 |
| kbps | 125 |
| Mbps | 125000 |
| Gbps | 125000000 |
The schedule rule form offers only the three units matching bandix.traffic.speed_unit (KiB/s, MiB/s, GiB/s in byte mode; kbps, Mbps, Gbps in bit mode). The global rate limit form always offers all six.
A value of 0 means unlimited in both forms ("Tip: Enter 0 for unlimited").
Schedule Rules
Adding a Rule
- On the Status page, click Settings in the device's row. The Device Settings dialog opens on the Rate Limits tab.
- Under Schedule Rules, click Add Rule.
- In Add Schedule Rule, set:
- Time Slot: start and end time (
HH:MM). The defaults are00:00and23:59. - Days of Week: toggle Mon to Sun. All seven days are selected by default.
- Upload Limit and Download Limit: value and unit. Both default to
0(unlimited).
- Time Slot: start and end time (
- Click Add.
The form refuses to save without a time slot ("Please set time slot") or without at least one day ("Please select at least one day").
Note: Limit values are read with
parseInt, so decimals are cut off:1.5MiB/s is saved as1MiB/s. To get 1.5 MiB/s, enter1536KiB/s instead.
Editing and Deleting Rules
Each rule in the list has Edit and Delete buttons. Edit opens the same form titled Edit Schedule Rule with the rule's values filled in. Delete asks "Are you sure you want to delete this schedule rule?" before removing it.
How Rules Are Displayed
The Rules / Quota column of the device list shows the rules in effect right now. The Status page decides which rules are active as follows:
- Today's weekday is converted to 1 (Monday) to 7 (Sunday) and must be in the rule's
days. - The current time, as
HH:MM, is compared with the rule's start and end:- if start ≤ end, the rule is active when start ≤ now ≤ end (both minutes included);
- if start > end, the slot crosses midnight (for example
22:00to06:00), and the rule is active when now ≥ start or now ≤ end.
- When several rules are active, the column shows the strictest limit per direction: the smallest non-zero value among them.
Hovering the column lists all of the device's rules under Schedule Rules (n).
Note: This "active" calculation runs in your browser using the browser's local time and weekday. If the browser's time zone differs from the router's, the column may show a rule as active (or not) while the backend enforces it on the router's clock. Enforcement itself is done by the backend.
The Status page reloads all schedule rules every second together with the device list. A separate poller is registered with an interval of 5000 seconds; the code comment says five seconds, but LuCI's poll.add takes seconds, so that poller effectively never adds anything.
Midnight-Crossing Slots
To limit a device from 22:00 to 06:00, enter start 22:00 and end 06:00 in a single rule. The Status page treats it as crossing midnight. Whether the backend applies the early-morning part to the day the slot started or to the following day is decided by the backend; if you need exact control, split it into 22:00–23:59 and 00:00–06:00 rules with separate days.
Saving Errors
If the RPC call itself fails, the page shows "Failed to save schedule rule: " followed by the error. If the backend answers but reports a failure, the RPC plugin returns "success": false with "API returned error response" and the raw response, but the Status page does not check that field: the dialog closes as if the save had worked. If a rule does not appear in the list after saving, call getScheduleLimits from the shell to see what the backend stored.
From the Shell
ubus call luci.bandix setScheduleLimit '{"mac":"aa:bb:cc:dd:ee:ff","start_time":"20:00","end_time":"23:59","days":"[1,2,3,4,5]","wan_tx_rate_limit":524288,"wan_rx_rate_limit":2097152}'
This limits upload to 512 KiB/s and download to 2 MiB/s on weekday evenings. days is a JSON array passed as a string. See setScheduleLimit.
Global Rate Limit
The global rate limit gives every device a default WAN limit, except devices on a whitelist.
Open it by clicking the Global Rate Limit badge in the device list toolbar on the Status page. The badge shows Enabled (n) or Disabled (n), where n is the number of whitelisted devices.
The dialog has three parts:
| Part | Effect |
|---|---|
| Enabled checkbox | "When enabled, all devices will be rate limited. Devices in the list are exempt (whitelist)." Toggling it takes effect immediately (setRateLimitWhitelistEnabled). |
| Default Rate Limit | Upload Limit and Download Limit with units; click Save (setDefaultRateLimit). |
| Exempt Devices (Whitelist) | List of exempt MAC addresses, each with Delete; a device picker plus MAC field and Add (addRateLimitWhitelist). |
When the dialog opens, stored limits are converted back to the most readable unit: exact multiples of the bit units (Gbps, Mbps, kbps) are shown in those units first; otherwise the value is shown in GiB/s, MiB/s or KiB/s with two decimals.
Added MAC addresses must match xx:xx:xx:xx:xx:xx (hex digits, colon-separated); otherwise the dialog shows "Invalid MAC address". Selecting a device in the picker fills the MAC field.
The values entered here accept decimals (they are parsed with parseFloat), unlike schedule rule limits.
How Schedule Rules and the Global Limit Interact
The LuCI pages only configure the two mechanisms; how the backend combines a device's active schedule rule with the global default is decided by the backend. The Rules / Quota column reflects schedule rules only.
Example: Evening Limit for a Games Console
- Give the console a recognizable hostname (see Devices and Hostnames).
- Open its Settings, click Add Rule.
- Time slot
19:00to22:00, days Mon to Thu and Sun. - Download limit
10Mbps (ifspeed_unitisbits) or1MiB/s (ifbytes); upload0. - Click Add. Between 19:00 and 22:00 on those days, the Rules / Quota column shows the limit.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| Limit has no effect | Hardware flow offloading or Turbo ACC is enabled, so packets bypass the eBPF programs; or the traffic is LAN-to-LAN |
| Rule saved but not listed | Backend rejected it; the Status page does not show backend errors (see Saving Errors) |
| Rule shows active at the wrong time | Browser and router time zones differ |
| Decimal limit became smaller | Schedule rule values are truncated to integers |