PCsuggest

  • Quick tip
  • SECURITY
  • NETWORKING
  • OpenWrt
  • HARDWARE

How to setup OpenWrt QoS with luci-app-sqm

Updated - April 18, 2020 by Arnab Satapathi

Fair bandwidth sharing among different devices may be an issue on a local network, say torrent client on the PC sucking all upload bandwidth. If the router is running openwrt, such situation could be avoided by setting up openwrt qos.

What is QoS ? It stands for Quality of Service, simply how efficiently the bandwidth could be used to improve network quality and minimize network latency.  It also ensures a fair portion of bandwidth is always available for critical applications.

Contents

  • Introduction to OpenWrt QoS LuCI, luci-app-sqm
  • Install and configure luci-app-sqm on openwrt
  • OpenWrt QoS settings with SQM in LuCI web interface
  • Test the openwrt qos capability
  • Conclusion and thoughts on QoS

Introduction to OpenWrt QoS LuCI, luci-app-sqm

Internet quality degradation on a fast network is mainly due to bufferbloat, excessive data buffering on the router causes this problem.

In this tutorial we're going to use the luci-app-sqm program to configure openwrt qos.

SQM stands for Smart Queue Management, and the SQM luci app is exactly for this, minimize the bufferbloat.

Smart Queue Management or SQM is easier to configure and understand than the previous luci-app-qos, as I think. Though both of them uses the tc command, part of traffic control application as QoS configuration back end. Read more about tc command here http://man.cx/tc .

I'm sure 99% people won't like to type a bunch of command to configure QoS on their router, that's why this openwrt qos luci application.

Install and configure luci-app-sqm on openwrt

Installation is pretty easy, you can install it from both command line and LuCI web interface.

Uninstall other previously installed(if any) OpenWrt QoS related packages like luci-app-qos or qos-scripts, they will interfere with sqm-scripts.

Installation process may require 550KB or more storage space, so if your router has limited flash space, openwrt extroot setup may be necessary. In fact you can't do this without extroot on a router with 4MB NOR flash, running OpenWrt Barrier Breaker (14.07) or later.

amazon prime logo
Try AmazonPrime for free
Enjoy free shipping and One-Day delivery, cancel any time.

Install through command line:-

  1. First login to the openwrt router through ssh and make sure the router can reach the internet properly.
    ssh root@192.168.1.1      # On PC
    ping -c 4 google.com      # On OpenWrt
  2. Now update the opkg package repository and and install luci-app-sqm, these commands will install SQM with all dependency.
    opkg update # On OpenWrt 
    
    opkg install luci-app-sqm # On OpenWrt
  3. Now start the SQM service and enable automatic startup after each reboot.
    /etc/init.d/sqm start # On OpenWrt 
    
    /etc/init.d/sqm enable # On OpenWrt

Install through LuCI web interface:-

  1. This method is even easier, login to the router's web interface and go to the System > Software section from the dropdown menu. Update the package list and put luci-app-sqm in the Download and install package: field, this will install SQM QoS service with all dependency.openwrt qos install luci-app-sqm
  2. Don't forget to start the SQM service, also add it to auto startup list , go to System > Startup section from the dropdown menu.luci enable sqm Hit the Disabled button to enable auto startup and hit the Start button to start QoS service, the screenshot above may be helpful.

OpenWrt QoS settings with SQM in LuCI web interface

At this step you need to determine your internet download/upload speed and network latency, measurement should be done when network is idle. The official OpenWrt guide recommends to use www.dslreports.com/speedtest for speed testing and latency measurement. But I'm using http://speedtest.net or https://www.speedcheck.org/ simply for more available test servers.

Though network latency measurement is not necessary, you could do it with ping command. Note the time required to ping different domains and take the average time. Example bellow

ping -c 4 www.google.de
ping -c 4 www.google.com.br

From those tests I got about 2.62 Mbps download and 2.98 Mbps upload speed with a USB 3G mobile broadband connection. Average network latency was 140mS to maximum ~450mS . You may want to use google's data transfer rate converter to convert different formats.

Now configure the SQM, go to the Network > SQM QoS setting from the LuCI web interface dropdown menu.

SQM settings:

  1. First check the enable box, in the Basic Settings tab to enable QoS .
  2. Select the Network interface, generally the eth1 or eth0 interface is used for the WAN network, for mobile broadband it's ppp0. For Tp-Link MR3220 the WAN interface is eth1 .
  3. Set the Download and Upload speed about 90-95% of your maximum speed, in kbps not kB/s, I've set 2480kbps download speed and 2800kbps upload speed, heavily rounded.
  4. Leave both options to default in the Queue Discipline tab, no need to change anything in the Show and Use Advanced Configuration section.
  5. Choose your connection type in the Link layer adaptation tab, it's pretty self explanatory, I'm choosing none as using a mobile broadband connection.
  6. Finally Hit the Save & Apply button, this will enable openwrt QoS on the router.

Test the openwrt qos capability

QoS capability could be tested many way, I'm giving an example bellow to simulate such situation.

  1. Connect a PC/laptop through the routers LAN port, if available, then run a heavy downloading app like a torrent client.
  2. Turn on router's wi-fi and connect one or two smartphone, start browsing few web pages.
  3. Give the wi-fi password to friends and tell them to chat on Skype.
  4. Connect another PC/laptop with the best ethernet cable you have to LAN port for testing.

Surely the above setup will impose a heavy stress on the network, now you from the last PC you could do some ping to remote servers like google, browse few webpages etc. etc. Now everything should be somewhat smoother than previous, i.e. without any QoS openwrt setup.

Credits: 50% credit goes to the official openwrt SQM documentation and rest 50% to Wikipedia, specially these links bellow.

  1. https://en.wikipedia.org/wiki/Bufferbloat
  2. https://en.wikipedia.org/wiki/Quality_of_service

Conclusion and thoughts on QoS

OpenWrt is bloating day by day, the luci is even more bloated, seriously a bad news for routers with limited flash.

DD-Wrt or Tomato USB could be alternative, but they don't support a wide range of hardware like openwrt.

Hope this openwrt qos tutorial is simple enough to understand and will help you to improve network quality. Just drop a comment if you have any suggestion or question, I'll like to hear from you.

Filed Under: networking, openwrt Tagged With: extroot, networking, openwrt, QoS

Your comments
  1. Igor says

    May 23, 2022

    Hello. Good article! Is it possible, using SQM, to limit the traffic bandwidth to a specific ip address or a separate interface, as in a simple shaper?

    Reply
  2. Ems says

    March 13, 2021

    Hi, maybe you will be able to help me, I have connected two PC one to LAN 1 and another to LAN3. I don't know how to seperate them and make qos for them, could you help me?

    Reply
  3. Dominik says

    February 21, 2021

    Hi
    thx for great guide
    My question

    im using OpenWrt 19.07.3 on netgear R6220
    and after listing interfaces i have:
    eth0
    br-lan(lan)
    eth0.1(lan)
    eth0.2(wan)
    wlan0(lan)
    wlan1(lan)
    pppoe-wan(wan)

    in configuration does it matter which network port I choose
    eth0.2(wan) or pppoe-wan(wan) ?
    i tested both and for pppoe-wan speedtest was lil bit faster
    thx
    Regards

    Reply
    • Arnab Satapathi says

      February 22, 2021

      Yes, it does matter, depending on the router, mot of them bridge the LAN interfaces together, but not the WAN interface.

      Reply
  4. Eric says

    February 4, 2020

    Thankyou. I had been experiencing serious bandwidth degradation on my Linksys WRT1900AC only in the evenings, just when my wife and daughter would fire up their tablets and PCs, and the TV would kick in. In desperation I tried several range extenders, and even powerline transmission. Nothing made a difference so it had to be the router. I installed OpenWrt on the router and played with various settings. Still no cigar. I finally found your page. Installing sqm in LUCI was a snap. After following your configuration instructions and using the DSL Reports Speedtest, bufferbloat, quality and speed all improved dramatically. I can finally surf from my remote upstairs den. I'm still looking into how to fine tune sqm, but that should be fun.

    Reply
    • Arnab Satapathi says

      February 6, 2020

      Good to know it helped you.
      Enjoy.

      Reply
  5. jonathan says

    November 11, 2019

    i have an issue i have the nighthawk r7800 i have istalled openwrt but it doesnt have luci-app-sqm how do i get this??
    also i tried in available packages and it have said when updating lists failed to download package from lists??
    how do i get this i even tried ssh to see if that would work but still not able to what could i be doing wrong??

    Reply
    • Arnab Satapathi says

      November 11, 2019

      Which OpenWrt/LEDE version you're using?
      May be the package isn't available anymore.

      Reply
  6. Art says

    November 2, 2017

    Another question!

    Would you mind explaining the options in the link layer adaptation tab? What would you suggest for standard residential LAN and WAN?

    Why did you choose "none" for mobile?

    Thanks again!

    Reply
  7. Art says

    October 31, 2017

    First off, thank you very much for this guide. I feel moderately comfortable with SSH access to devices, but have limited knowledge of networking topics, syntax, and linux. I find guide like yours extremely helpful as a networking and OpenWRT/LEDE neewbie.

    Quick question, how does this package differ from luci-app-qos or qos-scripts packages? What functionality is being traded here?

    Also what are the advantages for sqm approach, vs. trying to control or prioritize usage for certain devices?

    Thanks!

    Reply
    • Arnab Satapathi says

      October 31, 2017

      The truth is I never unpacked the both packages and looked inside to find out how they're working. I got overall better network responsiveness with SQM and continued using it.

      Now the second question, with the SQM approach you don't need to set priority of individual applications or devices again and again. It automatically calculates the best possible usage of the available bandwidth.

      Though I never analyzed the luci-app-sqm package, but I presume it reserves a portion of bandwidth for critical networking functionalities, while slowing down the download and upload speed a little, thus making a better user experience.

      https://wiki.openwrt.org/doc/howto/packet.scheduler/packet.scheduler, I think this page will be more useful for you.

      Reply
      • Art says

        November 1, 2017

        Great, thanks for the response. Will read more into the packet scheduler!

        Appreciate it!

        Reply
  8. anton says

    February 19, 2017

    Hi arnab

    My i have error notification like this

    "root@OpenWrt:~# opkg install luci-app-sqm
    Unknown package 'luci-app-sqm'.
    Collected errors:
    * opkg_install_cmd: Cannot install package luci-app-sqm."

    What seems to be the problem?

    Reply
    • Arnab Satapathi says

      February 19, 2017

      What's the OpenWrt version you're using ?
      Did you forgot to run opkg update before installing by any chance ?

      Reply
    • Leon says

      September 8, 2017

      You need to run "opkg update" first

      Reply
  9. BO says

    October 4, 2016

    Hi,

    Very well explained.
    I've go one question though : will we still be able to set bandwith limit for specified ipaddresses?

    Thanks a lot

    Reply
    • Arnab says

      October 5, 2016

      I'm not very sure, but I think we can, let me check.

      Reply
      • Sebastian Pieper says

        November 2, 2016

        Would love to know too please!

        Reply
  10. NG says

    September 20, 2016

    very useful. thanks

    Reply
  11. Ian says

    June 18, 2016

    Huge help. Thank you!

    Reply
    • Arnab says

      June 21, 2016

      Thanks for the feedback.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © PCsuggest.com · All rights reserved.

  • Home
  • About
  • Contact
  • Privacy Policy
  • Sitemap