Time conditions

Hi all.

Is there a way to prevent access to a certain website if a time condition is not met?
for instance, between 6am and 9:30am I dont want access to Youtube to be available…yes as you can guess, I want to stop my children access youtube before they go to school !! :laughing:

Thanks, Jeremy

1. add filter and layer7 firewall rules, for blocking youtube

/ip firewall layer7-protocol
add comment=Denied_YouTube name=Denied_YouTube regexp=“^.(get|GET).+(youtube).$”

/ip firewall filter
add action=drop chain=forward comment=Denied_YouTube disabled=yes layer7-protocol=
Denied_YouTube src-address=0.0.0.0/0


2. add scripts to auto enable and disable youtube access

/system script
add name=Enable_YouTube policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=
“/ip firewall filter disable [find comment="Denied_YouTube"];”
add name=Disable_YouTube policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=
“/ip firewall filter enable [find comment="Denied_YouTube"];”


3. add schedulers with the time you want to enable and disble youtube access

/system scheduler
add disabled=no interval=1d name=Disable_YouTube on-event=Disable_YouTube policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-date=
feb/22/2013 start-time=06:00:00
add disabled=no interval=1d name=Enable_YouTube on-event=Enable_YouTube policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-date=
feb/22/2013 start-time=09:30:00


4. Be sure that your routerboard has correct timing, if not you can use this:
4.a. Ntp servers that i use

/system ntp client
set enabled=yes mode=unicast primary-ntp=192.108.114.23 secondary-ntp=
84.16.227.200

4.b. Athens besouce i am in greece, you can change it to your counrty

/system clock
set time-zone-name=Europe/Athens