Skip to content

Instantly share code, notes, and snippets.

@pavelik
Forked from braian87b/sqm-openwrt-lede.sh
Created March 3, 2020 14:03
Show Gist options
  • Save pavelik/3f7df7f6393e1a377ff7f9af1e9a056e to your computer and use it in GitHub Desktop.
Save pavelik/3f7df7f6393e1a377ff7f9af1e9a056e to your computer and use it in GitHub Desktop.

Revisions

  1. @braian87b braian87b created this gist Jul 11, 2017.
    49 changes: 49 additions & 0 deletions sqm-openwrt-lede.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    Important: you should use values at around 95% of speedtest or 85% of ISP advertised speed.


    # using luci:
    opkg update; opkg install luci-app-sqm

    # without luci:
    opkg update
    opkg install sqm-scripts

    /etc/init.d/sqm enable
    /etc/init.d/sqm start
    #/etc/init.d/sqm restart
    # check logs just in case:
    logread
    # check defaults and backup them
    cat /etc/config/sqm
    cp /etc/config/sqm > etc-config-sqm.bak

    # example, 30Mb download, 3Mb upload
    WAN_NAME='wan'
    WAN_IFACE=`uci get network.wan.ifname`
    BW_DOWN='30'; BW_UP='3'

    uci del sqm.eth1

    # important config
    uci set sqm.$WAN_NAME='queue'
    uci set sqm.$WAN_NAME.interface=$WAN_IFACE # wan, Default 'eth1' (Interface de WAN)
    uci set sqm.$WAN_NAME.download=$(($BW_DOWN*1000*85/100)) # 95% of speedtest, 85% isp
    uci set sqm.$WAN_NAME.upload=$(($BW_UP*1000*85/100))
    # the rest:
    uci set sqm.$WAN_NAME.qdisc='fq_codel' # Default 'fq_codel'
    uci set sqm.$WAN_NAME.script='simple.qos' # Default 'simple.qos'
    uci set sqm.$WAN_NAME.linklayer='none' # Default 'none'
    uci set sqm.$WAN_NAME.qdisc_advanced='0' # Default '0'
    #uci set sqm.$WAN_NAME.ingress_ecn='ECN' # Default 'ECN'
    #uci set sqm.$WAN_NAME.egress_ecn='ECN' # Default 'ECN', docs stats NOECN: At low bandwidth, we recommend that you turn ECN off for the Upload (outbound, egress) direction
    #uci set sqm.$WAN_NAME.qdisc_really_really_advanced='0' # Default 0
    #uci set sqm.$WAN_NAME.itarget='auto' # Default 'auto'
    #uci set sqm.$WAN_NAME.etarget='auto' # Default 'auto'
    #uci set sqm.$WAN_NAME.overhead='0' # Default '0' # docs says for ADSL use: '44'
    # Default when using luci:
    uci set sqm.$WAN_NAME.verbosity='5' # Default luci 'auto'
    uci set sqm.$WAN_NAME.debug_logging='0' # Default luci 'auto'
    # enable it:
    uci set sqm.$WAN_NAME.enabled='1' # Default luci 'auto'

    /etc/init.d/sqm restart