Blocking video streaming?

You might have trouble doing this with sqm it's designed to be put on the wan interface. The qos scripts package might work better... But I'm not really sure. I use a custom tc script so I'm less familiar with the standard lede solutions

I am not familar with all these QoS-scripts, but the solution I use for my commercial hotspotsystems is the traffic throttle, incorporated in the "Captive Portal". I am using CoovaChilli for this.
However, it is a very steep learning curve, so be warned.
The reason for traffic throttle in Captive Portals is to give a fair share to every user.
So you might think about such a solution anyway.

The following script will place an HFSC qdisc on a given interface and limit it to a given bandwidth, (un-tested, based on some code I'm using, but could have syntax errors etc, it's a starting place. If you want to take advantage of any of the higher priority / higher throughput queues you'll need to design some filters, as is, everything goes into 50 which is limited to the lower bandwidth level given by the second argument to setup.

#!/bin/sh

setup (){

DEV=$1
BWTOT=$2
BWLIM=$3

tc qdisc del dev $DEV root
tc qdisc add dev $DEV handle 1: root hfsc default 50

# limit the total bandwidth to BWTOT, the actual link limit
tc class add dev $DEV parent 1: classid 1:1 hfsc ls m2 ${BWTOT}kbit ul m2 ${BWTOT}kbit

## these classes could be used to allow certain types of traffic access to more priority

## low latency stuff, uses 80% of max bw for up to 20ms to drain queues, then limited to up to 20% of max bw

tc class add dev $DEV parent 1:1 classid 1:10 hfsc ls m1 $(($BWTOT * 8/10))kbit d 20ms m2 $(($BWTOT*2/10))kbit
tc qdisc add dev $DEV parent 1:10 handle 10: fq_codel

## normal, 
tc class add dev $DEV parent 1:1 classid 1:20 hfsc ls m1 $(($BWTOT * 15/100))kbit d 20ms m2 $(($BWTOT*75/100))kbit
tc qdisc add dev $DEV parent 1:20 handle 20: fq_codel

## low priority
tc class add dev $DEV parent 1:1 classid 1:30 hfsc ls m1 $(($BWTOT * 5/100))kbit d 20ms m2 $(($BWTOT*5/100))kbit
tc qdisc add dev $DEV parent 1:30 handle 30: fq_codel

# limit everything else classified into default to BWLIM kbits regardless of whether more is available
tc class add dev $DEV parent 1:1 classid 1:50 hfsc ls m2 ${BWLIM}kbit ul m2 ${BWLIM}kbit

tc qdisc add dev $DEV parent 1:50 handle 50: fq_codel

} 

## now limit wlan0 to 10000kbit link speed, but at most 500kbit for anything going into the default class

setup wlan0 10000 500

Hopefully the example is sufficient to get you started if you want to go the custom route.

Also note that this is for the output of the wlan0 device, so it's basically limiting the "download" speed of your wlan clients. the fq_codel will share bandwidth across the connections in each category.

If you have wired clients they will be unaffected by this.

1 Like

This is not true, you can actually instantiate SQM on any interface, only note that for internally facing interfaces like LAN the meaing of ingress/downloading and egress/uploading reverse, this is because these directions are bound to the interface itself and not the internet.

That said, limiting WIFI with an external shaper is always a bit of a crutch, that most likely will affect air-time efficiency (by reducing the potential for frame aggregation) but for say throttling a wlan interface to 500 Kbps this should be the least of your concerns.

Best Regards

This forum is amazing.

@dlakelan: Thanks ever so much. I am going to try TC out.

@moeller0: I use multiple wlans, so I already lose some air-time efficiency. However I think airtime efficiency will drastically improve if I consider the ratio of (actual useful traffic)/ (actual useful traffic + network protocol overhead + streaming advertisements + dross etc.)

My understanding is that instantiating any qdisc on a bridge interface does nothing, you need to instantiate on each of the physical interfaces in the bridge. Never having used the sqm package I wasn't sure what it would do here.

@westislander you can use tc filters to place your real traffic into classes 10, 20, or 30. I'd suggest using class 10 for things like Skype or voip or games (in fact if you do this kind of stuff you can change class 10 to a real-time class), class 20 for normal stuff and class 30 for bulk downloads. The tricky bit is figuring out how to classify them...