Limit bandwith per IP/MAC with OpenWrt (Luci)?

Do you know any way for limit the bandwith per IP/MAC with openWRT Luci? I've alredy installed sqm/qos but is not what I want to do. I want to limit some devices to stay under 1MB/s, do you know any module for Luci to do this?

Are they wifi or Ethernet? You could put them on a different SSID or vlan and limit that entire interface with piece of cake using sqm

1 Like

luci-app-nft-qos and nft-qos seem to do what you want. No idea about the impact on bufferbloat for the throttled devices though. If you test it, please post about your experience here....

3 Likes

Could you give some more details regarding the HOWTO, without Luci, for custom image ?

I also need bandwidth limit per IP/MAC.

Out of curiosity what is the underlying goal? Why not just down prioritize certain devices rather than limiting to a specific bw ceiling

Me? I have not yet tried this (since I currently do not build my own builds), but https://github.com/rosywrt/nft-qos/tree/master/package/files indicates that you would need to edit nft-qos.config...

@dlakelan: Public hotspot. Just to give every user a fair share of the available bandwidth.

Aha, cakes per internal IP fairness is what you want!

Only ethernet, I will try @moeller0 's solution

Thanks, but how can I install it? from the filter option of the software's page in luci I can't find anything for "luci-app-nft-qos" or "nft-qos". Is there a repo with the manual instruction on how to install it / use it?

I agree with @dlakelan sqm-scripts with cake and the required config options for per-intetnal-IP-fairness and an AP that allows to use airtime fairness should get close to what you want. I note @tohojo just landed a patch for hostapd that might be relevant. From the patches announcement:
" This adds support to hostapd for configuring airtime policy settings for
stations as they connect to the access point. This is the userspace
component of the airtime policy enforcement system PoliFi described in this
paper: https://arxiv.org/abs/1902.03439

The kernel part has been merged into mac80211 for the 5.1 dev cycle.

The configuration mechanism has three modes: Static, dynamic and limit. In
static mode, weights can be set in the configuration file for individual
MAC addresses, which will be applied when the configured stations connect.

In dynamic mode, weights are instead set per BSS, which will be scaled by
the number of active stations on that BSS, achieving the desired aggregate
weighing between the configured BSSes. Limit mode works like dynamic mode,
except that any BSS not marked as 'limited' is allowed to exceed its
configured share if a per-station fairness share would assign more airtime
to that BSS. See the paper for details on these modes.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>

No changes since the RFC (except for a typo fix in a comment)"

I believe you will need to install a master snapshot (beware by default without luci) then someting like opkg update ; opkg install luci-app-nft-qos should get you going. But again, I have no actual experience with that package, just from its description it seems to fit your stated problem.
But after having given a response to your direct question, what is the larger scale problem you want to solve by manually distributing bandwidth among devices?

Another way is to use HFSC shaper+ tc flow!

Assuming a public hotspot, users tend to grab lot of temporary bandwidth simply by watching youtube movies. YT downloads as fast as it can, although in slices, generating spikes in high bandwidth usage, disturbing other users. Capping the WAN-bandwidth forces YT to download slower, but more often, flattening bandwidth usage.
Actually, I use squid for this purpose, because it is used anyway for some special tricks. But for bandwidth limit only it is overkill; same I can say for this traffic shaping stuff.
As a simple, rough solution I am looking at iptables+hashlimit, as an exact bandwidth limit is not necessary.

traffcishaper added recently.

A couple of clicks and the appropriate dual-srchost and dual-dsthost config in Luci. Done

How can I install (update ?) and use it?

Ok I will try thanks.

what is the larger scale problem you want to solve by manually distributing bandwidth among devices?

I would like to set a limit of download for multiple clients and let other users in the same network to fully use the network speed

Right, but why? If you can explain more about why we can maybe help you accomplish your ultimate goal better.

I would like to set a limit of download speed for multiple clients and let other users in the same network to fully use the network speed