Create Schedule for WiFi

How can i create a schedule to disable Wifi Access at 8:00pm and enable Access at 6:00am?

What i would like to is shutdown the Wifi Vlan interface on my router. How would i use the system scheduler to do this?



Thank you

I’d create a script in scheduler.
http://www.mikrotik.com/testdocs/ros/2.9/system/scheduler.php

Im looking for a script example

Do you wish to turn the radio off?
Or do you want to redirrect to a “we are closed” page?

Buth are doable…

all i want to do is disable the wifi vlan inteface on the router


Thank you

Create two schedualed Jobs.

  1. runs a script called “open” (or something like it). at 08:00
    Script “Open” = interface wireless enable wlan1 (Where wlan1 = name of wireless interface)

  2. runs a script called “Closed” (or something like it). at 16:00
    Script “Closed” = interface wireless disable wlan1 (Where wlan1 = name of wireless interface)


    This will turn off the interface at 16:00 and turn it back on at 08:00 (Local Router Time)..

Im looking for the proper script code

interface wireless disable wlan1

This will work.

csickles has been very helpful and gave you almost everything. You just need to add 5 minutes of thinking.

If you are not willing to put in the effort to help yourself, you should pay someone to do it for you.

I have tried to create the scrips to no avail, thats why I posted in the forum.

Evidently creating the script isnt that easy or someone probably would have posted the code.

OK..

What is the name of the interface (Wireless) that you want to cycle off and on?

I will create the scrips (In CLI format and drop them here)..

Thank you

The interface name is “vlan-hotspot”


Thank you very very much


have a great weekend

CLI “code” to create the scripts.

NOTE: change the name of “wlan2” to match the PHYSICAL interface you want to turn off and on…


/system script
add name=EnableWLAN policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source="interface wireless enable wlan2"

add name=DisableWLAN policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source="interface wireless disable wlan2"

After you paste the lines into a terminal session, go to system/scripts and verify the scripts created correctly.

You can test run the scripts by pressing run.. (remember, you will be turning off and on an interface when you test.)

Then goto system/schedual.
Next, create two scheduals. 1 will run the “EnableWLAN” the other will run the “DisableWLAN”
and be schedualed to run accordingly…

Make sure the local clock is set…

if you use static IP’s for CPEs in your network I would create 2 block firewall filter rules based on address list and enable/disable those rules based on a scheduled enable/disable rules.

this will give you central management, easy to enable/disable clients to connect to internet.

I think is better to have your CPEs with a minimum, simple configuration and do it complicated in only one router/firewall which will have control over your network. manage your CPEs at a central level and not at CPE level. one rule can manage them all instead of creating rules for every single one.

the way you do it - at CPE level - imagine: CPE has time settings but if after the script disables the wlan interface, if CPE suffers a power cut then time settings will be the default ones, which will make CPE not enable the wlan interface at wanted hour.

do you concur? probably the setup I described is not the one you have. :slight_smile:

Steven

Thank you Craig, that was the answer i was looking for



Have a great day

I found all necessary steps here: http://mlapshin.com/index.php/2015/09/01/mikrotik-and-dads-job/

How to create scripts

  • Open System → Scripts window
    Press Add button and the script editor window will open
    Type a script name like DisableWLAN
    Select policies required by the script or check all of them
    Type script into the source text area: interface wireless disable wlan1
    Make sure you are using the proper name of the wireless interface. It could be found in the Interfaces section.
    Next you can try to test the script with “Run Script” button
    Save the script with “OK” button
    Create a similar EnableWLAN script.

How to schedule scripts

  • Open System → Scheduler window
    Press Add button to open the Scheduler window
    Type some meaningful name for the scheduled task like DisableWLAN
    Type the name of your script into the On Event text area like DisableWLAN
    Select the start date, start time (hh:mm:ss format) and the interval for repeating the action like 1d 00:00:00 (it means one day and no hours, minutes and secs)
    Select required policies or check them all
    Save the schedule with “OK” button
    Repeat the same to schedule the enabling script

I created a schedule for starting and stopping WiFi. But if there is no power supply when the wifi have to be enabled, the wifi will be enabled the next day :open_mouth: . Do you have some suggestion to fix this situation? May be enable wifi every time when the router is starting?