Skip to content

Instantly share code, notes, and snippets.

@braian87b
Created July 11, 2017 12:55
Show Gist options
  • Save braian87b/571116c4e8be29f168204569905c87ed to your computer and use it in GitHub Desktop.
Save braian87b/571116c4e8be29f168204569905c87ed to your computer and use it in GitHub Desktop.
Enable SQM for OpenWRT / LEDE
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment