What's new

Scheduled QoS settings or bandwidth limit

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

fatice

Occasional Visitor
Is there a way to schedule QoS rules / bandwidth limit?

A simple way is: adjust priority according to time.
A more general way is to apply different rules at a different time.

Similarly, different bandwidth limit on certain IP/MAC address set under different time.

Do I have to create a script that runs on a cronjob to achieve this result?
 
Yup, just a simple 4 line script to update speeds and restart QOS at your desired scheduled times.

Code:
#!/bin/sh
nvram set qos_ibw=xxxxx
nvram set qos_obw=xxxxx
service "restart_qos;restart_firewall"

have cron execute the scheduled changes.

Enjoy!

(Keep in mind, cron tasks are NOT persistant through reboots).

You will have to setup your cron tasks withing another script called

init-start

located at

/jffs/scripts/init-start

to have them be persistent throughout reboots.

--

If you are using bandwidth limiter, pretty sure it is configured in some nvram variable that may or may not be the one I listed above.

I don't like bandwidth limiter, so I don't know which one exacatlly is off the top of my head.

Check out nvram changes after playing with qos with the following command

nvram show | grep "qos"

--

alternatively, instead of restarting qos

you can look into tc class change to change an existing setup

tc class change dev {br0 or eth0} parent {1:1} classid {1:11} {htb} prio {1} rate {1234}Kbit ceil {1234}Kbit burst {1234} cburst {1234}

view existing setups with

tc class show dev {br0 or eth0}

stuff between { } brackets are variables you need to define
 
Last edited:
Thanks for the help. Found a variable of interest

qos_rulelist=<Web Surf>>80>tcp>0~512>0
<HTTPS>>443>tcp>0~512>0
<File Transfer>>80>tcp>512~>2
<File Transfer>>443>tcp>512~>2
....

I just have to save the full qos_rulelist and apply different one on a schedule.

Side questions:

Setting NVRAM without committing it, those settings will not persist through reboots, but will it apply after if qos and firewall is restarted?

Will it speed up the wearing if NVRAM is committed too often?
 
Thanks for the help. Found a variable of interest

qos_rulelist=<Web Surf>>80>tcp>0~512>0
<HTTPS>>443>tcp>0~512>0
<File Transfer>>80>tcp>512~>2
<File Transfer>>443>tcp>512~>2
....

I just have to save the full qos_rulelist and apply different one on a schedule.

Side questions:

Setting NVRAM without committing it, those settings will not persist through reboots, but will it apply after if qos and firewall is restarted?

Will it speed up the wearing if NVRAM is committed too often?

Setting an nvram variable, without comming it, then issuing the restart QOS will have it take effect as you would expect it.

Committing the nvram needs to be done if you want to ensure the changes to persist throughout a reboot.

Yes not committing the variable will save nvram wear.
 
Thanks for the help.
With all these rules, schedule, settings, it would be hard to find another router to replace it. We will have to stay with Asus or get a commercial router.
 
Yup, just a simple 4 line script to update speeds and restart QOS at your desired scheduled times.

Code:
#!/bin/sh
nvram set qos_ibw=xxxxx
nvram set qos_obw=xxxxx
service "restart_qos;restart_firewall"

have cron execute the scheduled changes.

Enjoy!

(Keep in mind, cron tasks are NOT persistant through reboots).

You will have to setup your cron tasks withing another script called

init-start

located at

/jffs/scripts/init-start

to have them be persistent throughout reboots.

--

If you are using bandwidth limiter, pretty sure it is configured in some nvram variable that may or may not be the one I listed above.

I don't like bandwidth limiter, so I don't know which one exacatlly is off the top of my head.

Check out nvram changes after playing with qos with the following command

nvram show | grep "qos"

--

alternatively, instead of restarting qos

you can look into tc class change to change an existing setup

tc class change dev {br0 or eth0} parent {1:1} classid {1:11} {htb} prio {1} rate {1234}Kbit ceil {1234}Kbit burst {1234} cburst {1234}

view existing setups with

tc class show dev {br0 or eth0}

stuff between { } brackets are variables you need to define
Hi,
Is this still actual with Firmware Version: 386.1_2 ?

Can you please elaborate on the commands to switch between the presets "Work from Home" and "Games" for example?

Thanks!
 
Yup, just a simple 4 line script to update speeds and restart QOS at your desired scheduled times.

Code:
#!/bin/sh
nvram set qos_ibw=xxxxx
nvram set qos_obw=xxxxx
service "restart_qos;restart_firewall"

have cron execute the scheduled changes.

Enjoy!

Thanks for this. I added it as a rudimentary /jffs/script/bw-limiter.sh

Code:
#!/bin/sh

nvram set qos_enable=$1
nvram set qos_bw_rulelist="$1>192.168.1.240/28>768>768>0"
service "restart_qos;restart_firewall"

The above qos_bw_rulelist limits the IPs in the range of 192.168.1.240/28 (ipcalc) to 768 kbps download and 768 kbps upload.

Invoke it as '/jffs/script/bw-limiter.sh 1' to enable, or '/jffs/script/bw-limiter.sh 0' to disable.

If you wanted to leave QOS activated, qos_enable can actually be left out (as 1/enabled) because the first character of qos_bw_rulelist activates the line (1) or deactivates it (0), just like deselecting/selecting the line on the Web GUI. Not shown here is the nvram entry qos_type=2, which is the value for bandwidth-limiting mode.

I added the schedule to cron via cru manually, and also persisted them in the /jffs/scripts/services-start:

Code:
cru a BWLIMIT-WEEKDAY "0 23 * * 0-4 /jffs/scripts/bw-limiter.sh 1"
cru a BWLIMIT-WEEKEND "30 1 * * 5-6 /jffs/scripts/bw-limiter.sh 1"
cru a BWLIMIT-OFF "0 5 * * * /jffs/scripts/bw-limiter.sh 0"
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top