Exit Bufferbloat Enter OpenWRT and fq_codel

Print pagePDF pageEmail page

So! It’s been long since my last blog-post! But this one will compensate for the time I’ve been off-air.

Well, Logan‘s done a presentation on fq_codel and I got really interested in the topic. fq_codel (fair-queuing controlled delay), in a nutshell, was designed to overcome Bufferfloat; a phenomena in Networking whereby excess buffering of packets causes bottlenecks and thus reduces network quality. fq_codel is a scheduling algorithm that sets limits on delays suffered due to the bufferings. I won’t go too technical deep in this blog post.. This post will only show the setting-up of OpenWRT, and configuring it to enable CoDel and thus improve our networking performance. Hopefully, more posts about OpenWRT will follow including tutorials for some amazing features 🙂 Stay tuned !!

To be honest, I had some experience beforehand with those Operating Systems. I once got an Access Point from somebody that did not support bridge mode. I had to kick the propriety firmware out, install DDWRT, configure it (+ some tweaks 😛 ) and had it up and running. It’s still working since around a year or so..

The router I chose is a TPLINK WR841N; chose another model that had modem capabilities built-in but unfortunately, same did not support OpenWRT. Had to get it replaced by the vendor.

Well, let’s dive inside..

My Network Layout (Simplified)

Here’s a brief look at how my network is configured. DHCP is disabled on my Modem. The Router does the DHCP works.

My Home Network Layout

My Home Network Layout

Downloading OpenWRT

  1. Navigate to http://wiki.openwrt.org/toh/start
  2. In the table of hardware, look for your model (Please check the version number too. Mine in 9.x)
  3. Once you locate your device in the list, click on View/Edit Data in the far-right column of the table.table
  4. On the next page, Click on the Link next to Firmware Openwrt Install URL. This will download the .bin file to you PC.

Flashing the Router

  1. Now that we had the Openwrt Firmware downloaded, we can proceed to install it on our router.
  2. Login to the Router’s Web Panel (Typically typing the Router’s IP and entering the correct credentials).
  3. Navigate to the Upgrade Firmware page (System Tools >> Firmware Upgrade).
  4. Click on the Browse button, select the downloaded .bin file and click on Upgrade.
  5. Wait for the upgrade to be completed and the router to be rebooted.

Configuring the Router (First use; Password, Wireless SSID, Wireless Key)

Now that we have the new firmware running, first and foremost, the router does not have any admin password. Changing same is simple, click on the link in the warning message and you will be sent to the page to change the password. Remember to set a secure password. Here are tips on how to choose a good password.

This setup is optional, as the post is around bufferbloat and codel, but to change the SSID of your wireless network and set its passkey, navigate to Wifi through the Network menu and change accordingly.

Update the repo

Enough playing! Time for some serious stuffs! Simple as that, we need to first update the lists of packages in the router’s memory.

Navigate to the Software page through the System menu and click on Update Lists.


Downloading and install SQM

To control the flow/traffic for better performance, we need to apply QoS or Quality of Service rules. These rules, in a nutshell, chooses which part of the bulk traffic has priority over the others and according to which rules.

Unfortunately, the Openwrt version we are using here, does not have the QoS package installed. But thats why you are here, and therefore, we’ll show you how to do it.

  1. On the same page (Software), write luci-app-sqm and click on Find Package.
  2. From the list, click on Install and the package will be installed on your router.
  3. Next, navigate System >> Startup and Enable Startup for the sqm service.
  4. Reboot the server by navigate to the Reboot option on the System menu. Remember to click on Perform Reboot link, I once kept on waiting and then realised that I did not click on the fameux link! Grr!!

Configuring SQM

Tadaaa !! SQM (Smart Queue Management) is up and running on your Router!! Time now to configure it.

For this step I assume that you already know your download and upload speeds provided by your ISP.

  1. Navigate to the SQM QoS page through the Network menu.
  2. On Basic Settings page, tick the Enable checkbox and set the download and upload speeds to around 80% of speeds supposedly being provided by your ISP. Yes Sir! Supposedly!
  3. On the Queue Discipline tab, select fq_codel (YOOUHUU!) for Queueing Discipline and simplest.qos for Queue setup script.

Et Voila! Reboot and Served Chilled! 🙂

Tweaking to taste

The 80% value is the default value mentioned by articles on the Official OpenWRT page. But Logan and I carried lots of tests to get a somehow optimum configuration. We settled on 75-78 % for download and 46-48 % for upload. We also discovered that the speed up to which the ISP should be providing to me is not satisfactory.. The sentence seems somehow weird.. Well.. It’s because everywhere ISPs uses the terms UP TO.. So even 1 kbps is legal in a package providing UP TO 2048 kbps !! And yeah! That’s why I used the term SUPPOSED TO..

Below’s a chart of the test results history..


Final thoughts

My dreams to having A+ did not come true but I came out with a C and planning to tweak some more to get better results. It’s good to point out, that I have to, at some point, turn my modem’s mode into Bridging mode and set the WAN interface to PPPoE mode.

I did not post a Before-After pic, though I planned it because all our test are not yet completed plus I am thinking to alter my network layout etc etc.. But, in terms of performance, I’ve a more fluid YouTube experience but a less-bottlenecked connection.. e.g A Loud and Clear Skype Video conversation with a YouTube video loading in background in 360p.. Yes maybe it’s not a big deal for some.. but I’m very satisfied with those results and currently working on improving my home net 🙂

Words of Thanks

Thanks to my father for sponsoring my Router 😛

Thanks to Noor-e-Azam for his va-et-vient to and from the vendor. 🙂

And Yeah! Thanks to Logan for his codes and help. And thanks for  the 3rd Bufferbloat Soldier title 🙂

And to You.. Get Well Soon!! 😀

That’s all folks !!
Your questions, suggestions and of course testcases are most welcome!!

Till then,


  • Yasir

    Good job. Will tweak mine soon 🙂

    • Thanks Yasir 🙂
      Ahh greeaaat! 😀 😀 Hope you get the A+ for Bufferfloat in sha Allah !!

  • I have an RT-Ac66U asus, i can find openwrt only for RT-ac66U,
    any solution?
    GOod work though

    • Any difference in the two? Try looking for the differences in the two, should the chipset etc etc be the same, you can use the firmware.

      Thanks 🙂

  • supermujka

    Esselamu alejkum
    Here is my result im running asus n56u with stable release of Open WRT
    On default Asus firmware (or padavan) buffer bloat is from 500 to 1000 ms
    If i set Smart QoS on default asus firmware then buffer bloat is much better for A grade