Skip to content

Instantly share code, notes, and snippets.

@heri16
Last active March 12, 2024 20:28

Revisions

  1. heri16 revised this gist Mar 12, 2024. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-aarch64.t
    tar -xzvf /tmp/speedtest.tgz -C /usr/sbin/
    rm -f /tmp/speedtest.tgz /usr/sbin/speedtest.*
    chmod +x /usr/sbin/speedtest

    /etc/init.d/qosify stop
    speedtest --format=tsv > /tmp/speedtest.tsv &&
    BANDWIDTH_DOWN="$(($(cut -f6 /tmp/speedtest.tsv) / 125000))mbit" &&
    BANDWIDTH_UP="$(($(cut -f7 /tmp/speedtest.tsv) / 125000))mbit"
    @@ -16,8 +18,9 @@ echo BANDWIDTH_UP="${BANDWIDTH_UP}"

    # Edit this according to your ISP
    WAN_DEV="pppoe-wan"
    OVERHEAD_TYPE="ethernet"
    OVERHEAD_TYPE="none"
    INGRESS_EGRESS_OPTIONS=""
    #OVERHEAD_TYPE="ethernet"
    #INGRESS_EGRESS_OPTIONS="ether-vlan"
    INGRESS_OPTIONS=""
    EGRESS_OPTIONS="wash"
  2. heri16 revised this gist Feb 23, 2024. 1 changed file with 22 additions and 7 deletions.
    29 changes: 22 additions & 7 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,34 @@
    # After install qosify opkg package...
    cat /etc/config/qosify-opkg > /etc/config/qosify

    # Qosify
    # Measure Bandwidth (using https://www.speedtest.net/apps/cli)
    #wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz -O /tmp/speedtest.tgz
    wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-aarch64.tgz -O /tmp/speedtest.tgz
    tar -xzvf /tmp/speedtest.tgz -C /usr/sbin/
    rm -f /tmp/speedtest.tgz /usr/sbin/speedtest.*
    chmod +x /usr/sbin/speedtest
    speedtest --format=tsv > /tmp/speedtest.tsv &&
    BANDWIDTH_DOWN="$(($(cut -f6 /tmp/speedtest.tsv) / 125000))mbit" &&
    BANDWIDTH_UP="$(($(cut -f7 /tmp/speedtest.tsv) / 125000))mbit"
    echo BANDWIDTH_DOWN="${BANDWIDTH_DOWN}"
    echo BANDWIDTH_UP="${BANDWIDTH_UP}"

    # Manually set bandwidth
    #BANDWIDTH_UP="100mbit"
    #BANDWIDTH_DOWN="100mbit"

    # Edit this according to your ISP
    WAN_DEV="pppoe-wan"
    BANDWIDTH_UP="45mbit"
    BANDWIDTH_DOWN="92mbit"
    OVERHEAD_TYPE="ethernet"
    INGRESS_EGRESS_OPTIONS=""
    #INGRESS_EGRESS_OPTIONS="ether-vlan"
    INGRESS_OPTIONS=""
    EGRESS_OPTIONS="wash"
    INGRESS_EGRESS_OPTIONS="" // or "ether-vlan"

    ######################################
    # JESUS CHRIST IS THE LORD! AMEN #
    ######################################

    # Reset qosify config to defaults
    cat /etc/config/qosify-opkg > /etc/config/qosify

    # Qosify
    # Clear default config
    uci del qosify.@defaults[0].dscp_prio
  3. heri16 revised this gist Feb 1, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -315,12 +315,12 @@ udp:27015 gaming
    udp:3478-3497 multimedia_conferencing
    # Zoom
    dns:*zoom.* multimedia_conferencing
    dns:*zoom* multimedia_conferencing
    tcp:8801-8802 multimedia_conferencing
    udp:8801-8810 multimedia_conferencing
    # Skype
    dns:*skype.* multimedia_conferencing
    dns:*skype* multimedia_conferencing
    # FaceTime
    udp:16384-16387 multimedia_conferencing
  4. heri16 revised this gist Feb 1, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -315,12 +315,12 @@ udp:27015 gaming
    udp:3478-3497 multimedia_conferencing
    # Zoom
    dns:*zoom* multimedia_conferencing
    dns:*zoom.* multimedia_conferencing
    tcp:8801-8802 multimedia_conferencing
    udp:8801-8810 multimedia_conferencing
    # Skype
    dns:*skype* multimedia_conferencing
    dns:*skype.* multimedia_conferencing
    # FaceTime
    udp:16384-16387 multimedia_conferencing
  5. heri16 revised this gist Feb 1, 2024. 1 changed file with 4 additions and 6 deletions.
    10 changes: 4 additions & 6 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -197,12 +197,10 @@ dns:*akamaihd.* besteffort
    dns:*cdn.whatsapp.* besteffort
    # Google (Services)
    dns:google.*. besteffort
    dns:*.google.*. besteffort
    dns:googletagmanager.com besteffort
    dns:*.googletagmanager.com besteffort
    dns:googleapis.com besteffort
    dns:*.googleapis.com besteffort
    dns:google.* besteffort
    dns:*.google.* besteffort
    dns:*googletagmanager.com besteffort
    dns:*googleapis.com besteffort
    # YouTube (Streaming)
    dns:*googlevideo.* besteffort
  6. heri16 revised this gist Feb 1, 2024. 1 changed file with 45 additions and 30 deletions.
    75 changes: 45 additions & 30 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    cat /etc/config/qosify-opkg > /etc/config/qosify

    # Qosify
    WANDEV="pppoe-wan"
    WAN_DEV="pppoe-wan"
    BANDWIDTH_UP="45mbit"
    BANDWIDTH_DOWN="92mbit"
    OVERHEAD_TYPE="ethernet"
    @@ -86,7 +86,7 @@ uci reorder qosify.multimedia_conferencing=8
    uci reorder qosify.telephony=9
    # CAKE
    uci set qosify.wan.disabled="1"
    uci set qosify.wandev.name="$WANDEV"
    uci set qosify.wandev.name="$WAN_DEV"
    uci set qosify.wandev.disabled="0"
    uci set qosify.wandev.bandwidth_up="$BANDWIDTH_UP"
    uci set qosify.wandev.bandwidth_down="$BANDWIDTH_DOWN"
    @@ -147,47 +147,62 @@ dns:*updates.cdn-apple.* bulk
    dns:*xp.apple.* bulk
    # Microsoft (Download)
    dns:*1drv.ms bulk
    dns:*backblaze.* bulk
    dns:*backblazeb2.* bulk
    dns:*ms-acdc.office.* bulk
    dns:*onedrive.* bulk
    dns:*sharepoint.* bulk
    dns:*update.microsoft.* bulk
    dns:*windowsupdate.* bulk
    dns:*1drv.ms bulk
    dns:*backblaze.* bulk
    dns:*backblazeb2.* bulk
    dns:*ms-acdc.office.* bulk
    dns:*onedrive.* bulk
    dns:*sharepoint.* bulk
    dns:*update.microsoft.* bulk
    dns:*windowsupdate.* bulk
    # MEGA (Download)
    dns:*mega.io bulk
    dns:*mega.nz bulk
    dns:*mega.io bulk
    dns:*mega.nz bulk
    # Dropbox (Download)
    dns:*dropboxusercontent.* bulk
    dns:*dropboxusercontent.* bulk
    # Google (Download)
    dns:*drive.google.* bulk
    dns:*googleusercontent.* bulk
    dns:*drive.google.* bulk
    dns:*googleusercontent.* bulk
    dns:*1e100.net bulk
    # Steam (Download)
    dns:*steamcontent.* bulk
    dns:*steamusercontent.* bulk
    dns:*steamcontent.* bulk
    dns:*steamusercontent.* bulk
    # Epic Games (Download)
    dns:*download.epicgames.* bulk
    dns:*download2.epicgames.* bulk
    dns:*download3.epicgames.* bulk
    dns:*download4.epicgames.* bulk
    dns:*epicgames-download1.* bulk
    dns:*download.epicgames.* bulk
    dns:*download2.epicgames.* bulk
    dns:*download3.epicgames.* bulk
    dns:*download4.epicgames.* bulk
    dns:*epicgames-download1.* bulk
    # Playstation (Download)
    dns:*dl.playstation.* bulk
    dns:*dl.playstation.* bulk
    # Whatsapp (Download)
    dns:*mmg-fna.whatsapp.* bulk
    dns:*mmg-fna.whatsapp.* bulk
    # YouTube (Upload)
    dns:*upload.youtube.* bulk
    dns:*upload.video.google.* bulk
    dns:*gvt1.com bulk
    dns:*upload.youtube.* bulk
    dns:*upload.video.google.* bulk
    dns:*gvt1.com bulk
    # Akamai (CDN)
    dns:*akamaihd.* besteffort
    # Whatsapp (CDN)
    dns:*cdn.whatsapp.* besteffort
    # Google (Services)
    dns:google.*. besteffort
    dns:*.google.*. besteffort
    dns:googletagmanager.com besteffort
    dns:*.googletagmanager.com besteffort
    dns:googleapis.com besteffort
    dns:*.googleapis.com besteffort
    # YouTube (Streaming)
    dns:*googlevideo.* besteffort
    @@ -219,18 +234,18 @@ dns:*hbomaxcdn.* besteffort
    # Vevo (Streaming)
    dns:*vevo.com besteffort
    dns:*vevoprd.com besteffort
    dns:*vevoprd.* besteffort
    # Spotify (Streaming)
    dns:*pscdn.* besteffort
    dns:*scdn.* besteffort
    dns:*spotifycdn.* besteffort
    # Deezer (Streaming)
    dns:*dzcdn.net besteffort
    dns:*dzcdn.* besteffort
    # Soundcloud (Streaming)
    dns:*sndcdn.com besteffort
    dns:*sndcdn.* besteffort
    # Last.fm (Streaming)
    dns:*last.fm besteffort
  7. heri16 revised this gist Feb 1, 2024. 1 changed file with 107 additions and 40 deletions.
    147 changes: 107 additions & 40 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -116,72 +116,127 @@ udp:53 network_services
    udp:5353 network_services
    # DNS over TLS (DoT)
    tcp:853 multimedia_conferencing
    udp:853 multimedia_conferencing
    tcp:853 network_services
    udp:853 network_services
    # HTTP/HTTPS/QUIC
    tcp:80 browsing
    tcp:443 browsing
    udp:80 browsing
    udp:443 browsing
    # Apple (Download)
    dns:*appldnld.apple.* bulk
    dns:*gg.apple.* bulk
    dns:*gnf-mdn.apple.* bulk
    dns:*gnf-mr.apple.* bulk
    dns:*gs.apple.* bulk
    dns:*ig.apple.* bulk
    dns:*mesu.apple.* bulk
    dns:*ns.itunes.apple.* bulk
    dns:*oscdn.apple.* bulk
    dns:*osrecovery.apple.* bulk
    dns:*skl.apple.* bulk
    dns:*swcdn.apple.* bulk
    dns:*swdist.apple.* bulk
    dns:*swdownload.apple.* bulk
    dns:*swpost.apple.* bulk
    dns:*swscan.apple.* bulk
    dns:*updates-http.cdn-apple.* bulk
    dns:*updates.cdn-apple.* bulk
    dns:*xp.apple.* bulk
    # Microsoft (Download)
    dns:*1drv* bulk
    dns:*backblaze* bulk
    dns:*backblazeb2* bulk
    dns:*ms-acdc.office* bulk
    dns:*onedrive* bulk
    dns:*sharepoint* bulk
    dns:*update.microsoft* bulk
    dns:*windowsupdate* bulk
    dns:*1drv.ms bulk
    dns:*backblaze.* bulk
    dns:*backblazeb2.* bulk
    dns:*ms-acdc.office.* bulk
    dns:*onedrive.* bulk
    dns:*sharepoint.* bulk
    dns:*update.microsoft.* bulk
    dns:*windowsupdate.* bulk
    # MEGA (Download)
    dns:*mega* bulk
    dns:*mega.io bulk
    dns:*mega.nz bulk
    # Dropbox (Download)
    dns:*dropboxusercontent* bulk
    dns:*dropboxusercontent.* bulk
    # Google (Download)
    dns:*drive.google* bulk
    dns:*googleusercontent* bulk
    dns:*drive.google.* bulk
    dns:*googleusercontent.* bulk
    # Steam (Download)
    dns:*steamcontent* bulk
    dns:*steamcontent.* bulk
    dns:*steamusercontent.* bulk
    # Epic Games (Download)
    dns:*download.epicgames* bulk
    dns:*download2.epicgames* bulk
    dns:*download3.epicgames* bulk
    dns:*download4.epicgames* bulk
    dns:*epicgames-download1* bulk
    dns:*download.epicgames.* bulk
    dns:*download2.epicgames.* bulk
    dns:*download3.epicgames.* bulk
    dns:*download4.epicgames.* bulk
    dns:*epicgames-download1.* bulk
    # Playstation (Download)
    dns:*dl.playstation.* bulk
    # Whatsapp (Download)
    dns:*mmg-fna.whatsapp.* bulk
    # YouTube (Upload)
    dns:*upload.youtube.* bulk
    dns:*upload.video.google.* bulk
    dns:*gvt1.com bulk
    # YouTube (Streaming)
    dns:*googlevideo.* besteffort
    # Facebook (Streaming)
    dns:*fbcdn.* besteffort
    # Twitch (Streaming)
    dns:*ttvnw.* besteffort
    # YouTube
    dns:*googlevideo* besteffort
    # TikTok (Streaming)
    dns:*tiktok.* besteffort
    # Facebook
    dns:*fbcdn* besteffort
    # Netflix (Streaming)
    dns:*nflxvideo.* besteffort
    # Twitch
    dns:*ttvnw* besteffort
    # Amazon Prime Video (Streaming)
    dns:*aiv-cdn.* besteffort
    dns:*aiv-delivery.* besteffort
    dns:*pv-cdn.* besteffort
    # TikTok
    dns:*tiktok* besteffort
    # Disney Plus (Streaming)
    dns:*disney.* besteffort
    dns:*dssott.* besteffort
    # Netflix
    dns:*nflxvideo* besteffort
    # HBO (Streaming)
    dns:*hbo.com besteffort
    dns:*hbomaxcdn.* besteffort
    # Amazon Prime Video
    dns:*aiv-cdn* besteffort
    dns:*aiv-delivery* besteffort
    dns:*pv-cdn* besteffort
    # Vevo (Streaming)
    dns:*vevo.com besteffort
    dns:*vevoprd.com besteffort
    # Disney Plus
    dns:*disney* besteffort
    dns:*dssott* besteffort
    # Spotify (Streaming)
    dns:*pscdn.* besteffort
    dns:*scdn.* besteffort
    dns:*spotifycdn.* besteffort
    # HBO
    dns:*hbo* besteffort
    dns:*hbomaxcdn* besteffort
    # Deezer (Streaming)
    dns:*dzcdn.net besteffort
    # Soundcloud (Streaming)
    dns:*sndcdn.com besteffort
    # Last.fm (Streaming)
    dns:*last.fm besteffort
    # Reddit (Streaming)
    dns:*v.redd.it besteffort
    # BitTorrent
    tcp:6881-7000 bulk
    @@ -222,6 +277,10 @@ udp:3658 gaming
    tcp:3659 gaming
    udp:3659 gaming
    # GTA Online
    udp:6672 gaming
    udp:61455-61458 gaming
    # Minecraft
    tcp:25565 gaming
    udp:19132-19133 gaming
    @@ -231,6 +290,14 @@ udp:25565 gaming
    tcp:9339 gaming
    udp:9339 gaming
    # Steam Remote Play
    tcp:27036 gaming
    udp:27031-27036 gaming
    # Steamworks Game Server
    tcp:27015 gaming
    udp:27015 gaming
    # Zoom, Microsoft Teams, Skype and FaceTime (they use these same ports)
    udp:3478-3497 multimedia_conferencing
  8. heri16 revised this gist Feb 1, 2024. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # After install qosify opkg package...
    cat /etc/config/qosify-opkg > /etc/config/qosify

    # Qosify
    WANDEV="pppoe-wan"
    @@ -90,15 +91,16 @@ uci set qosify.wandev.disabled="0"
    uci set qosify.wandev.bandwidth_up="$BANDWIDTH_UP"
    uci set qosify.wandev.bandwidth_down="$BANDWIDTH_DOWN"
    uci set qosify.wandev.overhead_type="$OVERHEAD_TYPE"
    uci set qosify.wandev.autorate_ingress="0"
    uci set qosify.wandev.ingress_options="$INGRESS_OPTIONS"
    uci set qosify.wandev.egress_options="$EGRESS_OPTIONS"
    uci set qosify.wandev.options="$INGRESS_EGRESS_OPTIONS"
    uci del qosify.wandev.bandwidth
    uci set qosify.wandev.ingress="1"
    uci set qosify.wandev.egress="1"
    uci set qosify.wandev.mode="diffserv4"
    uci set qosify.wandev.nat="1"
    uci set qosify.wandev.host_isolate="1"
    uci set qosify.wandev.autorate_ingress="0"
    uci set qosify.wandev.ingress_options="$INGRESS_OPTIONS"
    uci set qosify.wandev.egress_options="$EGRESS_OPTIONS"
    uci set qosify.wandev.options="$INGRESS_EGRESS_OPTIONS"
    # Rules
    cat << "EOF" > /etc/qosify/00-defaults.conf
    # SSH
  9. heri16 revised this gist Feb 1, 2024. 1 changed file with 24 additions and 10 deletions.
    34 changes: 24 additions & 10 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    # After install qosify opkg package...

    # Qosify
    WANDEV="pppoe-wan"
    BANDWIDTH_UP="45mbit"
    BANDWIDTH_DOWN="92mbit"
    OVERHEAD_TYPE="ethernet"
    @@ -81,15 +84,21 @@ uci reorder qosify.gaming=7
    uci reorder qosify.multimedia_conferencing=8
    uci reorder qosify.telephony=9
    # CAKE
    uci set qosify.wan.name="wan"
    uci set qosify.wan.disabled="0"
    uci set qosify.wan.bandwidth_up="$BANDWIDTH_UP"
    uci set qosify.wan.bandwidth_down="$BANDWIDTH_DOWN"
    uci set qosify.wan.overhead_type="$OVERHEAD_TYPE"
    uci set qosify.wan.autorate_ingress="0"
    uci set qosify.wan.ingress_options="$INGRESS_OPTIONS"
    uci set qosify.wan.egress_options="$EGRESS_OPTIONS"
    uci set qosify.wan.options="$INGRESS_EGRESS_OPTIONS"
    uci set qosify.wan.disabled="1"
    uci set qosify.wandev.name="$WANDEV"
    uci set qosify.wandev.disabled="0"
    uci set qosify.wandev.bandwidth_up="$BANDWIDTH_UP"
    uci set qosify.wandev.bandwidth_down="$BANDWIDTH_DOWN"
    uci set qosify.wandev.overhead_type="$OVERHEAD_TYPE"
    uci set qosify.wandev.autorate_ingress="0"
    uci set qosify.wandev.ingress_options="$INGRESS_OPTIONS"
    uci set qosify.wandev.egress_options="$EGRESS_OPTIONS"
    uci set qosify.wandev.options="$INGRESS_EGRESS_OPTIONS"
    uci del qosify.wandev.bandwidth
    uci set qosify.wandev.ingress="1"
    uci set qosify.wandev.egress="1"
    uci set qosify.wandev.nat="1"
    uci set qosify.wandev.host_isolate="1"
    # Rules
    cat << "EOF" > /etc/qosify/00-defaults.conf
    # SSH
    @@ -265,4 +274,9 @@ EOF

    # Saving modified values
    uci commit qosify
    /etc/init.d/qosify restart
    /etc/init.d/qosify restart

    # Check if working
    qosify-status

    # Troubleshoot: cat /etc/config/qosify
  10. heri16 created this gist Feb 1, 2024.
    268 changes: 268 additions & 0 deletions qosify-init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,268 @@
    # Qosify
    BANDWIDTH_UP="45mbit"
    BANDWIDTH_DOWN="92mbit"
    OVERHEAD_TYPE="ethernet"
    INGRESS_OPTIONS=""
    EGRESS_OPTIONS="wash"
    INGRESS_EGRESS_OPTIONS="" // or "ether-vlan"

    ######################################
    # JESUS CHRIST IS THE LORD! AMEN #
    ######################################

    # Qosify
    # Clear default config
    uci del qosify.@defaults[0].dscp_prio
    uci del qosify.@defaults[0].prio_max_avg_pkt_len
    uci del qosify.besteffort
    uci del qosify.bulk
    uci del qosify.video
    uci del qosify.voice
    # ICMP (ping) and default class for "unmarked traffic"
    uci set qosify.@defaults[0].dscp_icmp="+besteffort"
    uci set qosify.@defaults[0].dscp_default_tcp="unmarked_traffic"
    uci set qosify.@defaults[0].dscp_default_udp="unmarked_traffic"
    # unmarked_traffic class
    uci set qosify.unmarked_traffic=class
    uci set qosify.unmarked_traffic.ingress="CS1"
    uci set qosify.unmarked_traffic.egress="CS1"
    uci set qosify.unmarked_traffic.prio_max_avg_pkt_len="1256"
    uci set qosify.unmarked_traffic.dscp_prio="CS4"
    uci set qosify.unmarked_traffic.bulk_trigger_pps="250"
    uci set qosify.unmarked_traffic.bulk_trigger_timeout="10"
    uci set qosify.unmarked_traffic.dscp_bulk="CS1"
    # browsing class
    uci set qosify.browsing=class
    uci set qosify.browsing.ingress="CS0"
    uci set qosify.browsing.egress="CS0"
    uci set qosify.browsing.prio_max_avg_pkt_len="575"
    uci set qosify.browsing.dscp_prio="AF41"
    uci set qosify.browsing.bulk_trigger_pps="1000"
    uci set qosify.browsing.bulk_trigger_timeout="10"
    uci set qosify.browsing.dscp_bulk="CS1"
    # bulk class
    uci set qosify.bulk=class
    uci set qosify.bulk.ingress="CS1"
    uci set qosify.bulk.egress="CS1"
    # besteffort class
    uci set qosify.besteffort=class
    uci set qosify.besteffort.ingress="CS0"
    uci set qosify.besteffort.egress="CS0"
    # network_services class
    uci set qosify.network_services=class
    uci set qosify.network_services.ingress="CS2"
    uci set qosify.network_services.egress="CS2"
    # broadcast_video class
    uci set qosify.broadcast_video=class
    uci set qosify.broadcast_video.ingress="CS3"
    uci set qosify.broadcast_video.egress="CS3"
    # gaming class
    uci set qosify.gaming=class
    uci set qosify.gaming.ingress="CS4"
    uci set qosify.gaming.egress="CS4"
    # multimedia_conferencing class
    uci set qosify.multimedia_conferencing=class
    uci set qosify.multimedia_conferencing.ingress="AF42"
    uci set qosify.multimedia_conferencing.egress="AF42"
    uci set qosify.multimedia_conferencing.prio_max_avg_pkt_len="575"
    uci set qosify.multimedia_conferencing.dscp_prio="AF41"
    # telephony class
    uci set qosify.telephony=class
    uci set qosify.telephony.ingress="EF"
    uci set qosify.telephony.egress="EF"
    # Reorder classes
    uci reorder qosify.unmarked_traffic=1
    uci reorder qosify.browsing=2
    uci reorder qosify.bulk=3
    uci reorder qosify.besteffort=4
    uci reorder qosify.network_services=5
    uci reorder qosify.broadcast_video=6
    uci reorder qosify.gaming=7
    uci reorder qosify.multimedia_conferencing=8
    uci reorder qosify.telephony=9
    # CAKE
    uci set qosify.wan.name="wan"
    uci set qosify.wan.disabled="0"
    uci set qosify.wan.bandwidth_up="$BANDWIDTH_UP"
    uci set qosify.wan.bandwidth_down="$BANDWIDTH_DOWN"
    uci set qosify.wan.overhead_type="$OVERHEAD_TYPE"
    uci set qosify.wan.autorate_ingress="0"
    uci set qosify.wan.ingress_options="$INGRESS_OPTIONS"
    uci set qosify.wan.egress_options="$EGRESS_OPTIONS"
    uci set qosify.wan.options="$INGRESS_EGRESS_OPTIONS"
    # Rules
    cat << "EOF" > /etc/qosify/00-defaults.conf
    # SSH
    tcp:22 network_services
    # NTP
    udp:123 network_services
    # DNS
    tcp:53 network_services
    tcp:5353 network_services
    udp:53 network_services
    udp:5353 network_services
    # DNS over TLS (DoT)
    tcp:853 multimedia_conferencing
    udp:853 multimedia_conferencing
    # HTTP/HTTPS/QUIC
    tcp:80 browsing
    tcp:443 browsing
    udp:80 browsing
    udp:443 browsing
    # Microsoft (Download)
    dns:*1drv* bulk
    dns:*backblaze* bulk
    dns:*backblazeb2* bulk
    dns:*ms-acdc.office* bulk
    dns:*onedrive* bulk
    dns:*sharepoint* bulk
    dns:*update.microsoft* bulk
    dns:*windowsupdate* bulk
    # MEGA (Download)
    dns:*mega* bulk
    # Dropbox (Download)
    dns:*dropboxusercontent* bulk
    # Google (Download)
    dns:*drive.google* bulk
    dns:*googleusercontent* bulk
    # Steam (Download)
    dns:*steamcontent* bulk
    # Epic Games (Download)
    dns:*download.epicgames* bulk
    dns:*download2.epicgames* bulk
    dns:*download3.epicgames* bulk
    dns:*download4.epicgames* bulk
    dns:*epicgames-download1* bulk
    # YouTube
    dns:*googlevideo* besteffort
    # Facebook
    dns:*fbcdn* besteffort
    # Twitch
    dns:*ttvnw* besteffort
    # TikTok
    dns:*tiktok* besteffort
    # Netflix
    dns:*nflxvideo* besteffort
    # Amazon Prime Video
    dns:*aiv-cdn* besteffort
    dns:*aiv-delivery* besteffort
    dns:*pv-cdn* besteffort
    # Disney Plus
    dns:*disney* besteffort
    dns:*dssott* besteffort
    # HBO
    dns:*hbo* besteffort
    dns:*hbomaxcdn* besteffort
    # BitTorrent
    tcp:6881-7000 bulk
    tcp:51413 bulk
    udp:6771 bulk
    udp:6881-7000 bulk
    udp:51413 bulk
    # Usenet
    tcp:119 bulk
    tcp:563 bulk
    # Live Streaming to YouTube Live, Twitch, Vimeo and LinkedIn Live
    tcp:1935-1936 broadcast_video
    tcp:2396 broadcast_video
    tcp:2935 broadcast_video
    # Xbox
    tcp:3074 gaming
    udp:88 gaming
    #udp:500 gaming # UDP port already used in "VoWiFi" rules
    udp:3074 gaming
    udp:3544 gaming
    #udp:4500 gaming # UDP port already used in "VoWiFi" rules
    # PlayStation
    tcp:3478-3480 gaming
    #udp:3478-3479 gaming # UDP ports already used in "Zoom" rules
    # Call of Duty
    #tcp:3074 gaming # TCP port already used in "Xbox" rules
    tcp:3075-3076 gaming
    #udp:3074 gaming # UDP port already used in "Xbox" rules
    udp:3075-3079 gaming
    udp:3658 gaming
    # FIFA
    tcp:3659 gaming
    udp:3659 gaming
    # Minecraft
    tcp:25565 gaming
    udp:19132-19133 gaming
    udp:25565 gaming
    # Supercell Games
    tcp:9339 gaming
    udp:9339 gaming
    # Zoom, Microsoft Teams, Skype and FaceTime (they use these same ports)
    udp:3478-3497 multimedia_conferencing
    # Zoom
    dns:*zoom* multimedia_conferencing
    tcp:8801-8802 multimedia_conferencing
    udp:8801-8810 multimedia_conferencing
    # Skype
    dns:*skype* multimedia_conferencing
    # FaceTime
    udp:16384-16387 multimedia_conferencing
    udp:16393-16402 multimedia_conferencing
    # GoToMeeting
    udp:1853 multimedia_conferencing
    udp:8200 multimedia_conferencing
    # Webex Meeting
    tcp:5004 multimedia_conferencing
    udp:9000 multimedia_conferencing
    # Jitsi Meet
    tcp:5349 multimedia_conferencing
    udp:10000 multimedia_conferencing
    # Google Meet
    udp:19302-19309 multimedia_conferencing
    # TeamViewer
    tcp:5938 multimedia_conferencing
    udp:5938 multimedia_conferencing
    # Voice over Internet Protocol (VoIP)
    tcp:5060-5061 telephony
    udp:5060-5061 telephony
    # Voice over WiFi or WiFi Calling (VoWiFi)
    udp:500 telephony
    udp:4500 telephony
    EOF

    # Saving modified values
    uci commit qosify
    /etc/init.d/qosify restart