Limit different bandwidth in day and night for different users
Limit Different Bandwidth In Day and Night.
There was an example earlier, about different bandwidth allowed for users at different times.
Let's say you have corporate users / institutions / government. People that arrive at 07.00 and leave the office 18.00 at most. You reserve them 1 mbit/s all the time. Most of your home users are using maximum bandwidth after 15.00 and up to 01.00 hours. So, you decide you may "lend" some of the bandwidth of the users that are not working, while they are not... How ?
You can of course add 2 ( two ) queues for each limit you want to put, but you can also put a single queue, and modify it's limits from a script. Might just be simpler. Why ? You keep the limits for different type of users in a single place. Ok. Now, for this to work, first of all sync your clock. Or you might get strange results and complains. :)
1. Premises: You are using simple queues to limit the traffic. ( it can be adapted to queue tree, by modifying limits in the queue types.... but that's another story ) You have 2 types of users: - 512k/512k at day, 2M/2M at night - 1M/1M at day, 4M/4M at night
/system ntp client set enabled=yes mode=unicast primary-ntp=213.239.154.12 secondary-ntp=213.249.66.35
( You can put primary-ntp and secondary-npt to be resolved to whatever 0.europe.pool.ntp.org and 1.europe.pool.ntp.org is pointing to. Do replace europe with your continent, for further improvement on response times and proximity. See ntp.org for further information )
I have used Simple Queue, Script and Scheduler.
Suppose we have one network 192.168.1.0/24 and want to limit Bandwidth for day and Night Time.
Network 192.168.1.0/24 Bandwidth = 06:00am – 18:00pm – 1Mbps. <Max-Limit> Bandwidth = 18:00pm – 06:00am – 2Mbps. <Max-Limit>
Create two simple queues for the same network with different Bandwidth Limit.
/queue simple #name=”Day” target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0 interface=<ether-x> parent=none direction=both priority=8 queue=default-small/default-small limit-at=512k/512k max-limit=1M/1M total-queue=default-small #name=”Night” target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0 interface=<ether-x> parent=none direction=both priority=8 queue=default-small/default-small limit-at=1M/1M max-limit=2M/2M total-queue=default-small
Now, write scripts
/system script #name=”Day” source=/queue simple enable Day; /queue simple disable Night #name=”Night” source=/queue simple enable Night; /queue simple disable Day
Finally, Schedule it
/system scheduler #name=”Day” on-event=Day start-date=oct/13/2007 start-time=06:00:00 interval=1d #name=”Night” on-event=Night start-date=oct/13/2007 start-time=18:00:00 interval=1d