OpenWrt Firmware (fq_codel/Cake)

These instructions assume you already flashed your router with openWrt.

Figuring out how to flash openWrt is a technical challenge if you’re not very tech savvy.

I’d recommend using a router with openWrt preinstalled (like the nanoPi R4S with friendWrt, or the router I sell here).

I believe the openWrt method is the best because it has the newest SQM algorithm, Cake. OpenWrt is constantly under development and usually has bleeding edge tech. Performance depends on your router’s hardware.

R4S users please enable Packet Steering under Network>Interfaces>Global network options before doing this.

The Method

Video guide: https://www.youtube.com/watch?v=pXaEc5zQKQU 

Login to your openWrt router (default address is 192.168.1.1). Default login for openWrt is username: root. The password is blank on initial setup.

Navigate to System > Software

Scroll down and remove any packages containing “qos”

Assuming your router is hooked up to the internet with an Ethernet wire. Click “Update lists”

Click the “Available Packages” tab

Find “luci-app-sqm” and click Install to install the package. This is the package that will solve bufferbloat….

After the sqm package is installed navigate to System > Startup

Find sqm and click on “Start”

After the sqm package is started. Navigate to Network > SQM QoS

Here check Enable SQM interface. For Interface name choose your WAN inteface (usually eth0 be default you can navigate to Network > Interfaces to make sure). For the Gl.inet router you should choose eth0. After that set “Download speed” to 85% of your max download speed. Do the same for “Upload speed”. For example if your max DL speed is 100 Mbits (then your Download Speed should be set to 85000 kbits)

Click on the Queue Discipline tab. You have two choices here. 1) Leave it as default with “fq_codel” and “simple.qos”or 2) Set it as “cake” and “piece_of_cake.qos”… Cake is better but consumes more resources so stick with the defaults if you have a low-end model.

For this last screenshot I will quote the wiki on https://openwrt.org/docs/guide-user/network/traffic-shaping/sqm

In the Link Layer Adaptation tab, choose the kind of link you have:
  • For VDSL – Choose Ethernet, and set per packet overhead to 34 (or 26 if you know you are not using PPPoE)
  • For DSL of any other type – Choose ATM, and set per packet overhead to 44
  • For Cable –  Choose Ethernet, and set per packet overhead to 22
  • For true ethernet or Fiber to the Premises – Choose Ethernet, and set per packet overhead to 44
  • When in Doubt, it’s better to overestimate – Choose packet overhead 44

After all these steps press “Save & Apply” and now you will never lag due to bufferbloat again! You can test it by visiting https://www.waveform.com/tools/bufferbloat

Calibration and Testing

Run “ping www.google.com -t” in command prompt and then run the speedtest.

If you still have an A rating, with low pings during the speedtest. You can incrementally increase your total bandwidth above the 85% you initially set until pings start to spike higher than desired.

Otherwise if your rating is not good or you are getting bad pings try reducing the max bandwidth limits. (Ex. If 85% is still lagging try 80%.)

Doing this allows you find the sweet spot between getting max bandwidth vs experiencing high pings.

Optional: Advanced Options for cake

These are further tweaks you can try to fine tune cake even further. In the Queue Discipline tab of SQM you can do the following….

This turns on squash_dscp, squash_ingress, ECN on ingress and NOECN on egress. Leave them as defaults as they are good the way they are. For reference, on your WAN port, ingress means download while egress means upload.

Next we are going to disable triple-isolate… and enable per host isolation.

To quote the docs, by default, cake will use triple-isolate: “which will first make sure that no internal or internal host will hog too much bandwidth and then will still guarantee for fairness for each host. In that mode, Cake mostly does the right thing. It would ensure that no single stream and no single host could hog all the capacity of the WAN link. However, it can’t prevent a BitTorrent client – with multiple connections – from monopolizing most of the capacity.”

You can enable per host isolation, which will identify all source/destination information. To enable that,

Add the following to the “Advanced option strings” (in the Interfaces → SQM-QoS page; Queue Discipline tab, look for the Dangerous Configuration options):

For queueing disciplines handling incoming packets from the internet (internet-ingress): nat dual-dsthost ingress

For queueing disciplines handling outgoing packets to the internet (internet-egress): nat dual-srchost

https://www.reddit.com/r/openwrt/comments/jqmboc/sqm_cake_and_piece_of_cake_makes_idm_download/gbtjc26/