CAKE QoS Script (OpenWrt)
This is the script that I made months ago (to self-learning) and until today I have time to share it.
With dual-dsthost enabled, a single host with many tcp sessions (like when torrenting) is prevented from hogging all the bandwidth, but if you are actually using that host, the torrent will still hog that host's bandwidth and to fix that problem you need QoS using DSCP marking, so that the torrent traffic and other such hogs goes into the "bulk class", then that host will see a big improvement in all other traffic types.
default qdisc
, TCP congestion control
and ECN
.irqbalance
and Packet Steering
options to equally distribute the load of packet processing over all available cores and probably increase performance.Init Script
so that from the LuCI web interface (System -> Startup
) you can Enable, Disable, Start, Restart and Stop the script.Hotplug
to automatically reload the script.To use this script, you need to install these packages:
Copy and paste this into your SSH client:
opkg update && opkg install tc-tiny kmod-sched-cake kmod-veth kmod-tcp-bbr irqbalance
Copy and paste this into your SSH client:
rm /root/cake.sh; rm /etc/init.d/cake; rm /etc/hotplug.d/iface/99-cake; rm /etc/nftables.d/*-rules.nft; wget -O /root/cake.sh "https://raw.githubusercontent.com/Last-times/CAKE-QoS-Script-OpenWrt/main/cake.sh"; chmod 755 /root/cake.sh
The cake.sh
script is located in the /root/
folder on the router and you have to edit this:
./cake.sh
Or download the script to edit it with the notepad and then place the edited script into the /root/
folder on the router, then change the permissions of the script with this command chmod 755 /root/cake.sh
and run the script with the command above ./cake.sh
Command to run the script:
./cake.sh
Others important commands:
# To check if the DSCP marking is working
tc -s qdisc
# To check your CAKE settings
tc qdisc | grep cake
# To check the veth devices
ip link show
# To check the nftables rules
nft list ruleset
# To check if changed the default OpenWrt settings
sysctl net.core.default_qdisc
sysctl net.ipv4.tcp_congestion_control
sysctl net.ipv4.tcp_ecn
# To check if irqbalance or packet steering are enabled or disabled
uci show irqbalance.irqbalance.enabled
uci show network.globals.packet_steering
Software flow offloading
, it will break the rules and CAKE.Copy and paste this into your SSH client:
/etc/init.d/cake stop; rm /root/cake.sh; rm /etc/init.d/cake; rm /etc/hotplug.d/iface/99-cake; rm /etc/nftables.d/*-rules.nft; sed -i "/default_qdisc/d; /tcp_congestion_control/d; /tcp_ecn/d" /etc/sysctl.conf; uci set dhcp.odhcpd.loglevel="4"; uci set irqbalance.irqbalance.enabled="0"; uci del network.globals.packet_steering; uci commit && reload_config