SQM with variable Bandwidth

Hey guys,

i got a wireless internet connection witha variable bandwith so I got the problem that qos or sqm not working fine to me.
the connection was variable from 50 to 20 mbit. So if i put the sqm to 20000 kbs there was no bufferbloat and downloads and voip working fine.
But if i want more speed and set it to 50000 kbs the values are wrong and i get high bufferbloat ...
This time i use cake with layer.qos and 20000 kbs and it worked fine ... but is lost a much off download speed.

Is there a possibility to get sqm working fine with variable bandwidth ? Anyone here got knowledge about it ?

Here the specs:
Router: WR1043n V1
LEDE: 17.01.0
Connection to internet: Ubiquiti Radio over wan port 1000 MBit
Donwloadspeed between 20 and 50 MBit
Uploadspeed between 10 and 20 MBit
Wan Interface is eth0.2
SQM activated on eth0.2 swith cake and layer.qos
No link layer activated because i got a routed network behind ubiquiti device.

Here the debug output:
/usr/sbin/tc qdisc del dev eth0.2 ingress
/usr/sbin/tc qdisc del dev eth0.2 root
/usr/sbin/tc qdisc del dev ifb4eth0.2 root
iptables -t mangle -D POSTROUTING -o ifb4eth0.2 -m mark --mark 0x00 -g QOS_MARK_eth0.2
iptables v1.4.21: goto 'QOS_MARK_eth0.2' is not a chain

Try `iptables -h' or 'iptables --help' for more information.
ip6tables -t mangle -D POSTROUTING -o ifb4eth0.2 -m mark --mark 0x00 -g QOS_MARK_eth0.2
ip6tables v1.4.21: goto 'QOS_MARK_eth0.2' is not a chain

Try `ip6tables -h' or 'ip6tables --help' for more information.
iptables -t mangle -D POSTROUTING -o eth0.2 -m mark --mark 0x00/0xff -g QOS_MARK_eth0.2
iptables v1.4.21: goto 'QOS_MARK_eth0.2' is not a chain

Try `iptables -h' or 'iptables --help' for more information.
ip6tables -t mangle -D POSTROUTING -o eth0.2 -m mark --mark 0x00/0xff -g QOS_MARK_eth0.2
ip6tables v1.4.21: goto 'QOS_MARK_eth0.2' is not a chain

Try `ip6tables -h' or 'ip6tables --help' for more information.
iptables -t mangle -D PREROUTING -i vtun+ -p tcp -j MARK --set-mark 0x2/0xff
iptables: No chain/target/match by that name.
ip6tables -t mangle -D PREROUTING -i vtun+ -p tcp -j MARK --set-mark 0x2/0xff
ip6tables: No chain/target/match by that name.
iptables -t mangle -D PREROUTING -i eth0.2 -m dscp ! --dscp 0 -j DSCP --set-dscp-class be
iptables: No chain/target/match by that name.
ip6tables -t mangle -D PREROUTING -i eth0.2 -m dscp ! --dscp 0 -j DSCP --set-dscp-class be
ip6tables: No chain/target/match by that name.
iptables -t mangle -D PREROUTING -i eth0.2 -m mark --mark 0x00/0xff -g QOS_MARK_eth0.2
iptables v1.4.21: goto 'QOS_MARK_eth0.2' is not a chain

Try `iptables -h' or 'iptables --help' for more information.
ip6tables -t mangle -D PREROUTING -i eth0.2 -m mark --mark 0x00/0xff -g QOS_MARK_eth0.2
ip6tables v1.4.21: goto 'QOS_MARK_eth0.2' is not a chain

Try `ip6tables -h' or 'ip6tables --help' for more information.
iptables -t mangle -D OUTPUT -p udp -m multiport --ports 123,53 -j DSCP --set-dscp-class AF42
iptables: No chain/target/match by that name.
ip6tables -t mangle -D OUTPUT -p udp -m multiport --ports 123,53 -j DSCP --set-dscp-class AF42
ip6tables: No chain/target/match by that name.
iptables -t mangle -F QOS_MARK_eth0.2
iptables: No chain/target/match by that name.
ip6tables -t mangle -F QOS_MARK_eth0.2
ip6tables: No chain/target/match by that name.
iptables -t mangle -X QOS_MARK_eth0.2
iptables: No chain/target/match by that name.
ip6tables -t mangle -X QOS_MARK_eth0.2
ip6tables: No chain/target/match by that name.
/sbin/ip link set dev ifb4eth0.2 down
/sbin/ip link delete ifb4eth0.2 type ifb

Mon Feb 27 14:58:41 CET 2017: Starting.
Starting SQM script: layer_cake.qos on eth0.2, in: 20000 Kbps, out: 10000 Kbps
Failed to find act_ipt. Maybe it is a built in module ?
/sbin/ip link add name TMP_IFB_4_SQM type ifb
/usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root cake
/sbin/ip link set dev TMP_IFB_4_SQM down
/sbin/ip link delete TMP_IFB_4_SQM type ifb
/usr/sbin/tc -p filter show parent ffff: dev eth0.2
/usr/sbin/tc -p filter show parent ffff: dev eth0.2
/sbin/ip link add name ifb4eth0.2 type ifb
/usr/sbin/tc qdisc del dev eth0.2 root
RTNETLINK answers: No such file or directory
/usr/sbin/tc qdisc add dev eth0.2 root cake bandwidth 10000kbit diffserv3
/sbin/ip link add name TMP_IFB_4_SQM type ifb
/usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM ingress
/sbin/ip link set dev TMP_IFB_4_SQM down
/sbin/ip link delete TMP_IFB_4_SQM type ifb
/usr/sbin/tc qdisc del dev eth0.2 handle ffff: ingress
RTNETLINK answers: Invalid argument
/usr/sbin/tc qdisc add dev eth0.2 handle ffff: ingress
/usr/sbin/tc qdisc del dev ifb4eth0.2 root
RTNETLINK answers: No such file or directory
/usr/sbin/tc qdisc add dev ifb4eth0.2 root cake bandwidth 20000kbit diffserv3
/sbin/ip link set dev ifb4eth0.2 up
/usr/sbin/tc filter add dev eth0.2 parent ffff: protocol all prio 10 u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb4eth0.2
layer_cake.qos was started on eth0.2 successfully

Seems that the QoS marking in iptables not work because the rule is not there ?!

Regards,
Snot

BTW: LEDE is the best firmware for my old 1043n V1 if ever seen ... !!!

The bandwidth changes on specific timeframe ? night and day for example? or it is just a turbo at start of connections?...

If it is the first scenario you just could use crontab with some uci set sqm... ;uci commit sqm; /etc/init.d/sqm restart and should be fine.

If it is the second, I recommend to use the modem/ISP wifi when needed more speed, or have two configured WAN's and using proper mwan3 rules to derive specific traffic to wan iface without sqm configured.

Hey braian87b,

the idea could be good ... adaptive qos :slight_smile:
I got a wifi connection over 5 km so the weather is the reason for the variable speed of my internet connection.
So maybe i could make a speedtest every hour and take the values from these to feed the sqm.

But how i could do this ... i dont know. I does not get eought scripting know how :frowning:

Check out the Gargoyle firmware. It does this by measuring RTT and adjusting your max limit accordingly. https://www.gargoyle-router.com/index.php

1 Like

Good idea! But please note that Gargoyle's ACC seems to expect a non-congested fixed bandwidth uplink, not exactly what a wifi link is going to offer...

Agreed, but if the other end is a standard asymmetrical broadband connection then uplink required is going to be much lower than what the link can handle.

If you are an adventurous coder, here is a hint for an algorithms that theoretically works:

This is not an out-of-the-box solution.

Mh, if your connection is WiFi then probably the bufflerbloat is at the other end (in the AP link) and you will just waste your time trying to solve this using SQM, but if you want to play, do some experiments and get dirt in your hands you could do measurements using ping, iperf, or even speedtest-cli watch logs (logread command) to see if you could get any identification to automatically perform the modifications to SQM configuration when its needed... if you are not enough good on scripting (as me as well) on OpenWRT but you feel more confortable for example on a Debian box for example, you could use a cheap RaspberryPi or something similar (a PogoPlug with Debian, etc...) and write some commands and read the output in Python scripts... Perform shell calls on Python It is easy, and use ssh to perform uci set and uci commit and /etc/init.d/sqm restart could be done using paramiko or similar library. Or just start digging in Google how to do an if in bash (it is very similar as in sh)

Just curious, how it is your setup of 5km range Wireless link? which hardware, etc...

Hey Brian...

i use Ubiquiti Equipment as is can. I use two PBE-5AC-620 across 5 KM ... the link got 230 MBit/s in Winter but now with the leafs i got only 20 Mbit and some disconnects so i have to change the position of my PBE's.
Its the best wifi equiment i've ever seen ...

Regards,
Snot

Thanks for the info!