Traffic Quotas
A traffic quota gives a device a data allowance on its WAN traffic for one or more periods: per minute, hour, day, week, month, or over its lifetime. When an allowance is used up, the backend blocks the device's WAN traffic until the period resets. Quotas are configured per device from the Status page.
Quota Periods
Each quota has up to six limits. Any limit set to 0 is unlimited and ignored.
| Period | Field | Label in the form |
|---|---|---|
| Minute | minute_bytes |
Minute |
| Hour | hourly_bytes |
Hourly |
| Day | daily_bytes |
Daily |
| Week | weekly_bytes |
Weekly |
| Month | monthly_bytes |
Monthly |
| Lifetime | total_bytes |
Lifetime |
For each period, the backend also reports the bytes used so far (minute_used_bytes, hourly_used_bytes, and so on) and whether the device is currently blocked. When the period boundaries fall (start of the day, week, month) is decided by the backend.
Quota Modes
| Mode | Value | Behavior |
|---|---|---|
| Combined quota | combined |
WAN upload and download are counted together against one set of limits. When a limit is reached, both directions are blocked. |
| Separate upload / download | directional |
Upload and download each have their own six limits. Only the exhausted direction is blocked. |
Separate mode needs a backend that announces supports_quota_modes: true in its quota list. With an older backend, the Separate upload / download option is disabled and the form says "This service supports combined quotas only. Update Bandix to use separate quotas."
Only the selected mode takes effect. Switching modes keeps the usage counters, and clears the limits of the other mode when you save.
Setting a Quota
- On the Status page, click Settings in the device's row.
- Switch to the Traffic Quota tab.
- Choose the Quota mode.
- For each period you want to limit, enter a number and pick a unit: B, KiB, MiB, GiB or TiB (powers of 1024). Decimals are allowed; the result is rounded to whole bytes.
- Click Save Quota.
Before any quota is saved, the form says "Usage starts when a quota is first saved." Usage is therefore only counted from that moment, not retroactively.
Empty unit selections default to MiB for the minute field and GiB for the others. When an existing quota is loaded, each value is displayed in the largest unit that divides it exactly, so 5368709120 bytes appears as 5 GiB.
Invalid values (negative numbers, non-numbers, or results above JavaScript's safe-integer range) are rejected with "Quota values must be non-negative and within the supported range."
Status Badges
Each section of the form (the combined section, or the upload and download sections) carries a badge:
| Badge | Meaning |
|---|---|
| Loading... | Quota list not loaded yet |
| Not configured | No quota saved for this device |
| Active | Quota saved and not exhausted |
| Blocked | A limit is exhausted; traffic in that direction is blocked |
| Not saved | You switched the mode but have not saved yet |
| Unavailable | The quota list could not be loaded |
Below each field, Used: X / Y shows the usage for that period against its limit (or "Unlimited"). It turns red once usage reaches the limit.
The form refreshes once per second while the dialog is open, without overwriting values you are typing.
How Quotas Appear in the Device List
The Rules / Quota column summarizes the quota:
- in combined mode, one line such as
Combined · Daily: 3.2 GiB / 5.0 GiB; - in separate mode, one line for Upload and one for Download.
Each line shows the period whose usage is closest to its limit (the highest used/limit ratio). A line that is blocked ends with · Blocked and is highlighted. Hovering the summary shows "Upload and download blocked", "Upload blocked", "Download blocked" or "Quota blocked" as appropriate.
Deleting a Quota
Click Delete Quota in the dialog and confirm "Delete this quota and all of its accumulated usage?". The quota and its accumulated usage are removed from the backend, so the device is no longer subject to any quota. The button is only shown when a quota exists.
Quotas from the Shell
The LuCI form uses setTrafficQuotaConfig, which takes the whole quota as a JSON string. Byte values travel inside that string, which avoids rpcd's 32-bit integer limit on regular parameters (useful above 2 GiB).
A combined 5 GiB daily and 100 GiB monthly quota:
ubus call luci.bandix setTrafficQuotaConfig '{"quota":"{\"mac\":\"aa:bb:cc:dd:ee:ff\",\"mode\":\"combined\",\"daily_bytes\":5368709120,\"monthly_bytes\":107374182400}"}'
A separate quota of 1 GiB upload and 10 GiB download per day:
ubus call luci.bandix setTrafficQuotaConfig '{"quota":"{\"mac\":\"aa:bb:cc:dd:ee:ff\",\"mode\":\"directional\",\"upload\":{\"daily_bytes\":1073741824},\"download\":{\"daily_bytes\":10737418240}}"}'
Limits that are not given are sent as 0. Output on success:
{
"success": true,
"message": "Traffic quota saved successfully"
}
List and delete:
ubus call luci.bandix getTrafficQuotas
ubus call luci.bandix deleteTrafficQuota '{"mac":"aa:bb:cc:dd:ee:ff"}'
The older setTrafficQuota method takes the six combined limits as separate integer parameters and is limited by rpcd's integer range.
Validation Rules
setTrafficQuotaConfig validates the quota before contacting the backend:
| Check | Error |
|---|---|
| The value is a JSON object | "Invalid quota configuration" |
mac is a string of the form xx:xx:xx:xx:xx:xx |
"Invalid MAC address" |
mode is combined or directional (default combined) |
"Invalid quota mode" |
Only the six limit keys, plus mac, mode, upload, download at the top level |
"Invalid quota limits" |
| Each limit is a JSON integer, at most 16 digits and ≤ 9007199254740991 | "Invalid quota limits" |
In directional mode, upload and download are objects with valid limits |
"Upload quotas are required", "Invalid upload quota limits", and the download equivalents |
In directional mode, the backend supports quota modes |
"Update the Bandix service to configure separate upload and download quotas." |
In directional mode, the top-level combined limits are sent as zeros; in combined mode, the upload and download objects are sent as zeros.
Quota Example: School-Night Allowance
To give a tablet 2 GiB per day and 30 GiB per month:
- Open the tablet's Settings, tab Traffic Quota.
- Mode Combined quota.
- Daily:
2GiB. Monthly:30GiB. Leave everything else at0. - Save Quota.
When the daily allowance runs out, the tablet loses internet access (LAN access keeps working) until the backend resets the daily counter.