CAKE QoS Script (OpenWrt)

Given the low guaranteed rate of the bulk class that seems a rather contentious position, but then your network, your policy.

If you use NAT on the archer then using the archer's IP address will be the only solution, if the archer just acts as wifi access point and all devices get their IP addresses from your primary OpenWrt router, then you will need to add the individual devices' IP addresses.

Assuming you want to force a single priority tier on all machines hanging off the archer.

1 Like

the IP of the archer is 192.168.0.x

That by itself does not tell me too much (it hints at the archer performing NAT but is not conclusive).
How is that archer configured:

  1. stock firmware or OpenWrt
  2. which port is connected to the OpenWrt primary router, the WAN port or one on the LAN port
  3. how is that port in the archer configured (presumably it is the archers WAN port configured as DHCP)
  4. what IP addresses do the computers connected to the archer get (presumably from the 192.168.0.X (aka 192.168.0.0/24) rang)
1 Like
ISP ---> rpi4b---->my pc
           |_____>AX20

That still does not answer the question unambiguously, the question you need to answer is, what IP-address does your rpi4b see for computers connected to the archer. If the archer is configured as NAT route, that will be the archers 192.168.1.105, if the archer is not configured for NAT than each connected host will likely get its IP address also from the 192.168.1.0/24 range and you will need to add addresses individually. It seems slightly more likely that your are running double NAT here but hard to prrof from the outside.

Side-note if you are truly running in double NAT mode and use cake's sul-srchost/dual-dsthost method, then all machines attached to the archer will (under contention) only count as a single machine in IPv4 and further down-prioritising them will likely have very little effect. You could try to instantiate an additional hard traffic shaper on the archer to not only limit their share under contention, but unconditionally, but IMHO you should first test whether your gaming works sufficiently well with the archer disconnected. Because if your problems are not caused by the rest of your users traffic, throttling them down seems unnecessarily unfriendly.

ADDED: about your diagram, since the rpi4b only has one ethernet interface how dod you connect it with three other devices:
a) one built in ethernet and two USB ethernet dongles?
b) one built in ethernet, a managed switch and three VLANs?
c) one built in ethernet and one USB ethernet dongle, and a managed switch & VLANs to split "my PC" and "AX20"?
d) something else using the rpi4b's WiFi to connect one of the three shown branches?

1 Like

hi,

your drop rate, if i calculate correctly, is 0.02% ... would not worry unless you actually notice the 223 drops out of the 1052325 (e.g. all relates to a VoIP call).

but let's understand couple of things:

  • everybody should read this fantastic post who has 500+ Mbit internet access,
  • some basics about home vs public networking and false high hopes regarding what you can or cannot control (sorry to referring my own post),
  • there are more and more forum threads and posts are opened each day about QoS/SQM/CAKE and looks there are many misunderstanding what you can expect realistically

so you have pretty decent internet connection and low-mid end home multi purpose device (router, AP, switch, fw) in one box, which was working nicely so far and now wondering if it is working with 500mbit internet (you've just upgrade to maybe due to lockdown) but you are at home with your family in lockdown everybody try to do work, video conf, playing, streaming simultaneously ... and now you start feeling problems. real or imaginary problems.
why not to enable sqm/cake/qosify, what could go wrong, it must be better with qos on, right?

not necessarily.

with a low-mid end relatively cheap device without qos you saturate your internet line because device has hw offloading which even if you're picked the right router which is fully supported by owrt still means hw (or less effective but still valid software) offloading the same. i.e. offloading is taking off the burden from the CPU (which is kind of weak in these type of devices) to deal with legitimate traffic, so the flow is very straight and direct between the end points, there is no need to process it as it is legitimate -> hence it is very quick and even a low end device can work with crafty internet access. it is acting like a switch bluntly speaking.

But. offloading is neutral to traffic type, it does not know if any traffic is more important for you, it is handling each packets equally. the very moment you switch on qos because you want to prioritize traffic it will use CPU as it has to check, identify, analyze and re-queue packets in a way you configure, not in the way they flowing in. which means no offloading can be used, but all traffic is now processed by the weak CPU! you have to pay the price of prioritization: for example giving up some of the paid bandwidth so your CPU still can handle the traffic (hence the recommendation to set qos thresholds to approximately 80% of your internet speed), or if you up mark something you should down mark something else to be in balance (or there will be more delay or even drops)!
you have a bottleneck, your router's CPU, no matter what you hope from qos, no matter how you tweak your configuration.

so in short know your limits and try to find an acceptable compromise between speed, latency, bandwidth, priorities and price. you cannot have all, sadly that's reality. any offered solution (sqm,qosify etc) if improves your situation it is great, just be happy with it, but it will not solve all your issues for sure. or accept the fact you need to invest real money to have much better internet experience.

2 Likes

+1: ALSO drops is the way cake/fq_codel signal specific flows to slow down, so not only are drops (under saturating conditions) unavoidable, but for an AQM they are signs of the AQM actually working as intended. Sure, if the endpoints negotiated to use ECN and the link is not severely overloaded these drops could be replaced be CE-marking to instruct (well-behaving and responsive) flow to slow down, but there are quite a lot of IFs in that sentence...

QoS often is not needed I agree to that, but sqm, especially cake can offer attractive features even to fast links, like per IP-fairness and better micing/interleaving of different flows (resulting in less jitter for all flows).

Plus offloading often comes at the cost of generality, so by using offload engines to have a router punch above its true weight class one needs to trade in the potential to do a few things one might or might not desire; not a show-stopper for offloads but certainly something to keep in mind. (Making things simpler is one of the ways how offloads reduce the processing load, but some complexity exists to enable some features, removing that complexity hence removes the ability to use those features).

+1; excellent way of describing the challenge here!

2 Likes

if the integrated is connected to my isp and the 2 USB dongles go one to my PC and the other to the archer

So given the properties of the different ethernet controllers most people use one of the USB dongles for the WAN side and the integrated for the LAN side.

That still hints at the archer doing NAT but is not 100% conclusive. If you connect a computer t6 the archer, what IP address will it get?

1 Like

no, the integrated is wan and the two dongles are for lan

OK I interpret that as archer does NAT, so your QoS rule (runing on the rpi4b) would only need to be for 192.168.1.105 and should cover all connected devices on the archer as well.

Yes, I understand that that is what you do here. I was stating that generally people here using rpi4bs with SQM/cake seem to recommend to use one of the USB dongles for the WAN side, but your netwrk, your decisions.

1 Like

this is a little confusing in my language, I must assume that it is enough to use the ip of the archer

2 Likes

is it because all the bandwidth is reached ?

No, because if there is an issue with USB then at least the router will be reachable from your LAN to debug.

2 Likes

I think part of the reason is that USB dongles tend to be over-buffered and have their own bufferbloat, but if you use a traffic shaper like cake these USB-dongle buffers will never overfill. But this is from hearsay, I did not try to convert my rpi4b into router service, it acts as my GPS disciplines time server instead.

1 Like

my family told me that they had Internet disconnections, I should assume that because they are in the mass class, my doubt that is the problem ?

Bulk only has very little guaranteed throughput in total, this is why I would consider it rude to put the rest of my family's traffic in the bulk tin.

But as long as there is no other traffic in one of the higher tins they should be getting all of the capacity. So what else was going on in your network during that they reported the internet disrupted? (And keep in mind that the cause of their promblem might actually be outside of your home network)

3 Likes

latency for me remained low until now, they just said the connection was cut off when they were in a meeting (meet), then came back

hi,

just a note to anyone trying to use this (or probably other similar) script and Voice over IP (VoIP): there is a common misunderstanding how VoIP works. Without understanding the concept this script will not do what you expect, from VoIP point of view at least.
so, VoIP is not just SIP, it can be H323 as well, they are different protocols but are common in one aspect which is the problem here: both are differentiating between signalling and media traffic!

## Voice over Internet Protocol (VoIP)
ipt46dscp -p tcp -m multiport --ports 5060:5061 -j DSCP --set-dscp-class $TELEPHONY -m comment --comment "VoIP to $TELEPHONY (TCP)"
ipt46dscp -p udp -m multiport --ports 5060:5061 -j DSCP --set-dscp-class $TELEPHONY -m comment --comment "VoIP to $TELEPHONY (UDP)"

The problem with this part from the script are:

  • assumes VoIP = SIP, if your using H323 should adjust ports,
  • assumes the default port 5060 and Secure SIP 5061 are used but it can be actually whatever high port, should adjust to match to your config,
  • missing the media part !! the media traffic is more important than the signalling traffic (covered only here), there should be additional rule with the UDP port range used by media traffic,
  • this is signalling traffic only, it may cog up the EF queue, media traffic is usually using small packets and should be in EF, the signalling traffic rather be in AF31. some QoS designs even check packet size and only allow <500bytes in EF, which is usually not the case with "chatty" SIP for example.

this script is a great summary how to do CAKE/DSCP. don't get me wrong, just if you use VoIP don't forget about media and VoIP != SIP is my suggestion.

otherwise great work, thank you!

1 Like

hi xato i recommand if you are wrt3200 400/400 for best bufferbloat,

my mate has rt3200 like me and the best bufferbloat is with 400/400 have a nice day and good game :wink: