START=50
start() {
tc qdisc add dev veth0 root cake bandwidth 30Mbit besteffort triple-isolate nonat wash no-ack-filter split-gso rtt 100ms noatm overhead 60
ip link add name ifb type ifb
tc qdisc add dev ifb root cake bandwidth 30Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms noatm overhead 60
tc qdisc add dev br-lan handle ffff: ingress
ip link set ifb up
tc filter add dev br-lan parent ffff: protocol ip prio 1 u32 match ip dst 192.168.1.0/24 action pass
tc filter add dev br-lan parent ffff: prio 2 matchall action mirred egress redirect dev ifb
}
stop() {
tc qdisc del dev br-lan ingress
tc qdisc del dev veth0 root
tc qdisc del dev ifb root
ip link set ifb down
ip link del ifb
}
Do you need cake on br-lan if it’s already catching download traffic on veth0?
In the upload direction you can just use cake on the wan interface for egress since Wireguard will make unique flow hashes available for flow fairness on wan egress.
better terminology would be veth-br and veth-lan... both of them are facing the LAN but the veth-br is inside the bridge, whereas the veth-lan is external to the bridge and sends towards the bridge.
Thank you all for your patience with me and all the helpful insight.
It seems I have made a mountain out of a molehill, but I have enjoyed the ride.
For anybody wanting to set up SQM in the context of WireGuard + PBR, one easy solution is as follows:
For upload:
apply cake on wan using 'flows nonat'
(as identified in this thread, WireGuard preserves flow hashes available for flow fairness on wan egress - so it really is this simple)
For download:
set up veth-br, with peer veth-lan and add veth-br to br-lan
route inbound traffic from vpn / wan to veth-lan
apply cake on veth-lan
(this presents an interface that receives only vpn/wan traffic, and so avoids shaping lan<>router traffic)
I am still to apply @moeller0's test, but from my basic testing so far seems to be working. So long as zoom and teams calls go uninterrupted despite Netflix and windows and Android/iPhone software updates then I'm happy.
I think a way to implement this on Asus Wrt Merlin would be to add veth-br to br0, reroute wan and VPN download to veth-lan and then create IFB on br-lan with the tc filter rules I gave above to filter out router-lan traffic. Something like:
ip link add name ifb type ifb
tc qdisc add dev ifb root cake bandwidth 30Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms noatm overhead 60
tc qdisc add dev br-lan handle ffff: ingress
ip link set ifb up
tc filter add dev br-lan parent ffff: protocol ip prio 1 u32 match ip dst 192.168.1.0/24 action pass
tc filter add dev br-lan parent ffff: prio 2 matchall action mirred egress redirect dev ifb
The QoS override script would facilitate that. But the rerouting would presumably need attention with respect to VPN Director.
Rerouting on OpenWrt is easy once you ditch the main straight jacket VPN PBR implementation and use netifd PBR with simple rules in LuCi (thanks for this insight @vgaetera and for your LuCi work to make this possible).
Merlin would take some convincing even though this would make CAKE work for all cases (no VPN, VPN, VPN with PBR, multiple VPNs etc.).