, ,

Mikrotik time-based queue for night and day

 If you desire to know how to implement a Mikrotik time-based queue to apply different queues to clients or networks based on the time of the day, then you are reading the right post. After reading this article, you will be able to configure a Mikrotik router to assign a certain bandwidth plan to a client in the day and a different bandwidth plan at night.

The implementation of a Mikrotik time-based queue will be configured using simple queue with scripts and schedulers to automatically assign bandwidth plans to customers based on time of the day. ISPs use this method to provide extra speed to customers during off-peak periods.

Lab requirement

The implementation of Mikrotik time-based queue can be achieved on any Mikrotik router capable of simple queue. For this demonstration, the Mikrotik hAP lite series was used.

Implementation

Since Mikrotik time-based queue works with the router’s time, it is important that the time on the router remains accurate at all times. For to happen, the router must be configured as an NTP client. See commands to configure the router as an NTP client below:

/sys ntp client set primary-ntp=bd.pool.ntp.org enabled=yes

The next step is to create two simple queues; one for day (peak period) and the other for night (off-peak period). See commands below:

/queue simple add name=day target=192.168.10.2/32 max-limit=2M/2M add name=night target=192.168.10.2/32 max-limit=4M/4M

Next, we create a script that will enforce this queues. See commands below:

/system script add name=Day source=/queue simple enable day; /queue simple disable night add name=Night source=/queue simple enable night; /queue simple disable day

See below image for how to implement it on Winbox. Simply click on system>script and eneter values similar to the ones in the image below.

The final step involves the configuration system scheduler to activate any of the queues referenced in the script, depending on the system time. See commands below:

/system scheduler name=Day on-event=Day policy=read,write start-date=may/07/2023 start-time=06:00:00 interval=1d name=Night on-event=Night policy=read,write start-date=may/07/2023 start-time=18:00:00 interval=1d

The scheduler will execute, based on the router time, and cause the script to activate the desired queue while disabling the other. See the result of executing the “Day” script below.

0 $type={blogger}: