Community discussions

MikroTik App
 
twistsd
newbie
Topic Author
Posts: 26
Joined: Fri Mar 15, 2019 11:57 am

Script & Schedule for Network on & off

Fri Mar 15, 2019 12:02 pm

I am new to using MikroTik routers and looking for some help if possible. I have created a virtual wireless network 2.4 & 5 Ghz for users who use our premises during the week but like to have it only available between 8-30am & 5pm Monday to Friday. Any help would be greatly appreciated.
Thanks
 
gotsprings
Forum Guru
Forum Guru
Posts: 2102
Joined: Mon May 14, 2012 9:30 pm

Re: Script & Schedule for Network on & off

Fri Mar 15, 2019 2:25 pm

You could do this several ways...
A simple way to "learn" or "start" would be to make 2 scripts and 2 schedules.
One enables the INTERFACES
One disables the INTERFACES

What are the names of the virtual interfaces?
 
twistsd
newbie
Topic Author
Posts: 26
Joined: Fri Mar 15, 2019 11:57 am

Re: Script & Schedule for Network on & off

Fri Mar 15, 2019 2:38 pm

gotsprings thanks for your reply.
The virtual interfaces are called Training 2.4GHz & Training 5GHz, can it be done using a bridge?
Thanks
 
WeWiNet
Long time Member
Long time Member
Posts: 592
Joined: Thu Sep 27, 2018 4:11 pm

Re: Script & Schedule for Network on & off

Fri Mar 15, 2019 6:22 pm

What gotspings mean is, set up your AP as you want (Wifi and SSID names etc) and then everything works you
add the switch on off function for Wifi i/f.

In system/Scheduler you can run scripts at certain time of the day.
Just put in the command you would enter into a terminal like below into the body of the schedule tab:
/interface wireless set MY_WIFI_IF disabled=yes

to disable it
/interface wireless set MY_WIFI_IF disabled=no

to enable it

Assign time of the day to run them as you want. With this the Wifi network will not work outside your hours.

For more control/granularity, use the "wireless"/ "Access List".
In the Wifi interface tab uncheck default authenticate, now you will need "access list entry" that someone can connect
to your network.
If you want to block everybody, just create one, leave all fields empty (you can also select which Wifi i/f you want) and assign
at the bottom of the tab under "TIME" the day and individual times of the day to allow access.
 
gotsprings
Forum Guru
Forum Guru
Posts: 2102
Joined: Mon May 14, 2012 9:30 pm

Re: Script & Schedule for Network on & off

Fri Mar 15, 2019 9:53 pm

Then this would kill it
:log info "Turning OFF Training."
/interface disable [find name~"Training"]
:log info "Training DOWN."
This would bring it back up.
:log info "Turning ON Training."
/interface enable [find name~"Training"]
:log info "Training UP."
You can get fancy with if then and time of day...
But a Scheduler Should be your first thing you figure out...

Blocking via firewalls with time is easy... but its way cooler to have the SSID Turn Off.
 
twistsd
newbie
Topic Author
Posts: 26
Joined: Fri Mar 15, 2019 11:57 am

Re: Script & Schedule for Network on & off

Mon Mar 18, 2019 10:16 am

gotsprings,

Thanks for the scripts they done exactly what I wanted.

Thanks
 
gotsprings
Forum Guru
Forum Guru
Posts: 2102
Joined: Mon May 14, 2012 9:30 pm

Re: Script & Schedule for Network on & off

Mon Mar 18, 2019 3:53 pm

Figured this out when I was working on caps-man. When you have to disable the SSID across more than one radio... that code made life much easier.
 
twistsd
newbie
Topic Author
Posts: 26
Joined: Fri Mar 15, 2019 11:57 am

Re: Script & Schedule for Network on & off

Wed Mar 20, 2019 3:59 pm

gotsprings,

The script and schedule work fine but I have an issue with the DHCP server linked to the bridge for the SSID's when the off script runs the text for the DHCP Server goes red italic, when the on script runs it stays red but is no longer italic.

Any advise would be helpful.

Thanks
 
gotsprings
Forum Guru
Forum Guru
Posts: 2102
Joined: Mon May 14, 2012 9:30 pm

Re: Script & Schedule for Network on & off  [SOLVED]

Thu Mar 21, 2019 5:08 am

Connect a client and it will turn black?

Who is online

Users browsing this forum: No registered users and 25 guests