What's new

[AC87U]: Limit Bandwidth On 5GHz Band Using Script

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

dzg7pl

New Around Here
Hi everybody,

I'm trying to write a script that does the following:
  • Read a list of user/device name/mac addresses/limit
  • Check if the device is active (i.e. bandwidth is over a given threshold) - e.g. every minute
  • Count the times the device is over this threshold
  • If the device breaches the LIMIT read in for that MAC, then limit the up/down bandwidth for that device.
I have got all this working for eth1 (2.4GHz) using the tc command. However, I am unable to use tc for wifi0 - tc reports it cannot find the device.

The code I am using to limit the bandwidth is as follows:

tc qdisc add dev $IF root handle 1: htb default 30
tc class add dev $IF parent 1: classid 1:1 htb rate $DNLD
tc class add dev $IF parent 1: classid 1:2 htb rate $UPLD
U32="tc filter add dev $IF protocol ip parent 1:0 prio 1 u32"
$U32 match ip dst $IP/32 flowid 1:1
$U32 match ip src $IP/32 flowid 1:2


Can anyone help?

Cheers

Tim
 
Probably impossible on the 87U, the 5ghz chip is totally separate to the rest of the system

Just thinking about this though - how does the UI manage to do this then? Surely if it can be achieved by the UI, there must be a way to do this, mustn't there?
 
Just thinking about this though - how does the UI manage to do this then? Surely if it can be achieved by the UI, there must be a way to do this, mustn't there?
i think you'd need to dig in to communicating with the quantenna chip
 
i think you'd need to dig in to communicating with the quantenna chip
Yeah, I've been looking into the qcsapi_sockrpc command and its miriad of options, but none of the wifi related ones appear to fit the bill. I've also enabled telnet on the Quantenna chip and had a play with tc on there, but the only interface that is recognised is eth1_0, but that doesn't allow me to run the commands I've set out above! Argh!
 
Ok, think I've got it - iptables appears to work:

modprobe -a xt_hashlimit.ko
iptables -N RATE_LIMIT
iptables -I FORWARD 1 -p ALL -m mac --mac-source $MAC -j RATE_LIMIT
iptables -A RATE_LIMIT_$USER -m hashlimit --hashlimit-above 1kb/s --hashlimit-burst 1kb --hashlimit-mode srcip,dstip --hashlimit-name bwlimit -j DROP

Appears to work across both bands - hurrah! More testing required though.
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top