What's new

Limiting Time (hours per day) is it possible?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

simon_g

New Around Here
Hi

Is it at all possible to limit not just the hours within a day a device can access but the number of hours as well

for example i want my kids to have access to the PC's for 9am - 9pm but I only want them having 2 hours during that timeframe

this would be killer for me :)
 
Hi

Is it at all possible to limit not just the hours within a day a device can access but the number of hours as well

for example i want my kids to have access to the PC's for 9am - 9pm but I only want them having 2 hours during that timeframe

this would be killer for me :)

You might need to setup a separate router double NATed behind your primary router with hotspot software loaded on it like they use in coffee shops where they sell internet access. This type software used to be available to run on routers running DD-WRT. Look at the Wiki for DD-WRT.

The setup would be that you would sell 2 hours of service daily to your children. To cut the internet off at night you would just set the router to turn the radios off at 9 PM. If that doesn't kill the kid's connection plug the router into a lamp timer set to power off the router at 9 PM.
 
No, 'fraid not.
I think the GUI do not allow for this... But... Could it not be something with a cron-job running e.g. once every hour, a script parsing syslog entries (need some logging of ip addresses or mac-addresses?) followed by a rule-based decision to change iptables-rules? Just thinking - theoretically...
 
If you are looking to limit bandwidth, that is reasonably easy.

If you are looking to limit access, like with stubborn children or free WiFi, that is not so easy.


Some routers offer a feature called "Captive Portal" which may offer what you want.
 
you could do it for wi-fi connections by using the built-in scheduler (Professional tab in Wifi) to only have the radio on during certain times of the day. or you could maybe just set the PC to be on a scheduled guest network if you really need both bands of your router for other devices. i'm not aware of any possibility to do this for wired connections on consumer-grade routers.

you could just buy a wireless NIC for the PC and remove the cable, or just disable the wired NIC from the Device Manager or Network and Sharing Center (assuming you use Windows). if you have a regular User account for your children then they won't be able to enable it. i think this solution would be cheaper than buying a professional switch.
 
Did this ever go anywhere? I'd like something like this for my kids too!

I started something and now have a simple 2 hour limit per day for the XBox One, however it's all in 1 hit, so when the XBox turns on the clock starts, and anything outside that requires me to unblock the XBox manually. I plan on modifying my scripts to do just what you're looking for... when I find time!

Cheers
 
Did this ever go anywhere? I'd like something like this for my kids too!

I started something and now have a simple 2 hour limit per day for the XBox One, however it's all in 1 hit, so when the XBox turns on the clock starts, and anything outside that requires me to unblock the XBox manually. I plan on modifying my scripts to do just what you're looking for... when I find time!

Cheers
Only thing I can think of is the AIprotection time scheduling feature. Have a look at that and see if it would work for you or not.
 
Only thing I can think of is the AIprotection time scheduling feature. Have a look at that and see if it would work for you or not.

Thanks, but no, it's not working for me. I'll continue to develop my scripts. I have a straight 2 hour limit that kicks in when the XBox is turned on, but need to make it more flexible to allow say 2 x 1 hour blocks within the day. I think it'll be achievable... just need to find the time.
 
Thanks, but no, it's not working for me. I'll continue to develop my scripts. I have a straight 2 hour limit that kicks in when the XBox is turned on, but need to make it more flexible to allow say 2 x 1 hour blocks within the day. I think it'll be achievable... just need to find the time.
Ah ok, yea sounds like you want something with a little more customization. Would be interested in seeing your script once your finished. I have kids that I would love to use this on now that school has started. ;) I've use the time schedule to make sure the oldest doesn't continue to watch tv or play games late at night. :mad:
 
Thanks, but no, it's not working for me. I'll continue to develop my scripts. I have a straight 2 hour limit that kicks in when the XBox is turned on, but need to make it more flexible to allow say 2 x 1 hour blocks within the day. I think it'll be achievable... just need to find the time.
Take a look see under "guest". It allows you to impose time limits (like 2 hours). I do not know if it's robust enough for your needs.
 
Hi

Is it at all possible to limit not just the hours within a day a device can access but the number of hours as well

for example i want my kids to have access to the PC's for 9am - 9pm but I only want them having 2 hours during that timeframe

this would be killer for me :)
Take a look at "Norton Family".
Time supervision allows specification of blocked hours of the day and can alert (limit?) if number of hours used exceeds what you specify the number of hours allowed hours by day.

Sent using Tapatalk
 
Ah ok, yea sounds like you want something with a little more customization. Would be interested in seeing your script once your finished. I have kids that I would love to use this on now that school has started. ;) I've use the time schedule to make sure the oldest doesn't continue to watch tv or play games late at night. :mad:

Hi Quicksilver,

I've got something rough working:

##########################################
admin@RT-AC86U:/jffs/scripts/xbox# cat xboxcheck.sh
#!/bin/sh

#default state is xbox is blocked. Add this to init-start script
#4am cron to clear xbox flag
#see /jffs/scripts/init-start

maxtime=7300

#If daily flag set. No more checking.
if [ -f /jffs/scripts/xbox/xboxdailyflag ]
then
exit
fi


#Tiime of Day Restrictions

#dow = day of week. 1=Monday - 7=Sunday
dow=`date +%u`
#hod = hour of day.
hod=`date +%k`

if [ $dow -le 5 ]
then
#Weekday
maxtime=3700

if [ $hod -lt 15 ]
then
#Quit out if before 16:00. Not going to continue running, so no xbox
exit
fi

if [ $hod -ge 20 ]
then
#End of the day. Block the xbox
/jffs/scripts/xbox/xboxstop.sh
touch /jffs/scripts/xbox/xboxdailyflag
fi

fi



if [ `wl -i eth5 assoclist | grep "C0:33:5E:D3:17:54" | wc -l` -eq 1 ]
then

#If XBOX ON, increment seconds counter (in a file). Reset file to 0 each night.

#read previous time, and add 5 mins (cron job runs every 5 mins)
prevtime=`cat /jffs/scripts/xbox/xboxison`
totaltime=`expr $prevtime + 300`
echo $totaltime > /jffs/scripts/xbox/xboxison
logger XBOX On $totaltime of $maxtime

#if prevtime == 0 then xbox just turned on. Unblock it.
if [ $prevtime -eq 0 ]
then
/jffs/scripts/xbox/xboxstart.sh
fi

#If $totaltime > Maxtime then block xbox
if [ $totaltime -gt $maxtime ]
then
/jffs/scripts/xbox/xboxstop.sh
touch /jffs/scripts/xbox/xboxdailyflag
fi

fi


##########################################
admin@RT-AC86U:/jffs/scripts/xbox# cat xboxstop.sh
#!/bin/sh

logger XBOX blocked
#/usr/sbin/iptables -C FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
if [ `iptables -L FORWARD | grep C0:33:5E:D3:17:54 | wc -l` -eq 0 ]
then
logger XBOX Adding iptables
/usr/sbin/iptables -I FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
#nvram set MULTIFILTER_MAC=`nvram get MULTIFILTER_MAC`\>C0\:33\:5E\:D3\:17\:54
#nvram set MULTIFILTER_DEVICENAME="`nvram get MULTIFILTER_DEVICENAME`>XboxOne"
#nvram set MULTIFILTER_ENABLE=`nvram get MULTIFILTER_ENABLE`\>2
#nvram commit
fi


##########################################
admin@RT-AC86U:/jffs/scripts/xbox# cat xboxstart.sh
#!/bin/sh

logger XBOX Unblocked
#/usr/sbin/iptables -C FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
if [ `iptables -L FORWARD | grep C0:33:5E:D3:17:54 | wc -l` -eq 1 ]
then
logger XBOX Deleting IPTables Entry
#The below command is dodgy AF
#/usr/sbin/iptables -D FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
/usr/sbin/iptables -D FORWARD `iptables -L FORWARD --line-numbers | grep "C0:33:5E:D3:17:54" | awk '{print $1}'`
#nvram set MULTIFILTER_MAC=`nvram get MULTIFILTER_MAC | sed 's/>C0:33:5E:D3:17:54//g'`
#nvram set MULTIFILTER_DEVICENAME="`nvram get MULTIFILTER_DEVICENAME | sed 's/>XboxOne//g'`"
#nvram set MULTIFILTER_ENABLE=`nvram get MULTIFILTER_ENABLE | sed 's/>2//'`
#nvram commit
fi


##########################################
admin@RT-AC86U:/jffs/scripts/xbox# cat xboxreset.sh
#!/bin/sh

#Zero the counter file, clear the daily flag and block the xbox

logger xbox reset

echo 0 > /jffs/scripts/xbox/xboxison
rm -f /jffs/scripts/xbox/xboxdailyflag
/jffs/scripts/xbox/xboxstop.sh


##########################################
Append these to /jffs/scripts/init-start

#Reset the xbox timer
/usr/sbin/cru a resetxbox "30 4 * * * /jffs/scripts/xbox/xboxreset.sh"
#Check XBox every 5 mins
/usr/sbin/cru a checkxbox "*/5 * * * * /jffs/scripts/xbox/xboxcheck.sh"



Not sure you'll make sense of it!!??

Essentially, I have a 1 script to block the xbox, another to unblock, another to check every 5 mins, and a 4th to reset everything in the middle of the night.

If we wish the xbox to to be allowed on the network after it's been blocked for the day, we can use the router GUI (or the app) to block and then unblock the device, because the above scripts do not get reflected in the GUI. The commented out "MULTIFILTER" nvram variables control the blocking and time scheduling from the GUI, and I don't want to go there just yet as we tend to manually block and unblock other devices randomly, so don't want to break this, but it looks like it's do-able.

Hope this works for you - it appears to work for me right now.

Cheers!
 
For your copy and paste ease:

Code:
admin@RT-AC86U:/jffs/scripts/xbox# cat xboxstart.sh 
#!/bin/sh

logger XBOX Unblocked
#/usr/sbin/iptables -C FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
if [ `iptables -L FORWARD | grep  C0:33:5E:D3:17:54 | wc -l` -eq 1 ]
then
 logger XBOX Deleting IPTables Entry
 #The below command is dodgy as
 #/usr/sbin/iptables -D FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
 /usr/sbin/iptables -D FORWARD `iptables -L FORWARD --line-numbers | grep "C0:33:5E:D3:17:54" | awk '{print $1}'`
 #nvram set MULTIFILTER_MAC=`nvram get MULTIFILTER_MAC | sed 's/>C0:33:5E:D3:17:54//g'`
 #nvram set MULTIFILTER_DEVICENAME="`nvram get MULTIFILTER_DEVICENAME | sed 's/>XboxOne//g'`"
 #nvram set MULTIFILTER_ENABLE=`nvram get MULTIFILTER_ENABLE | sed 's/>2//'`
 #nvram commit
fi

admin@RT-AC86U:/jffs/scripts/xbox# cat xboxstop.sh 
#!/bin/sh

logger XBOX blocked
#/usr/sbin/iptables -C FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
if [ `iptables -L FORWARD | grep  C0:33:5E:D3:17:54 | wc -l` -eq 0 ]
then
 logger XBOX Adding iptables
 /usr/sbin/iptables -I FORWARD -m mac --mac-source C0:33:5E:D3:17:54 -j DROP
 #nvram set MULTIFILTER_MAC=`nvram get MULTIFILTER_MAC`\>C0\:33\:5E\:D3\:17\:54
 #nvram set MULTIFILTER_DEVICENAME="`nvram get MULTIFILTER_DEVICENAME`>XboxOne"
 #nvram set MULTIFILTER_ENABLE=`nvram get MULTIFILTER_ENABLE`\>2
 #nvram commit
fi

admin@RT-AC86U:/jffs/scripts/xbox# cat xboxcheck.sh 
#!/bin/sh

#default state is xbox is blocked. Add this to init-start script
#4am cron to clear xbox flag
#see /jffs/scripts/init-start

maxtime=7300

#If daily flag set. No more checking.
if [ -f /jffs/scripts/xbox/xboxdailyflag ]
then
 exit
fi


#Time of Day Restrictions

#dow = day of week. 1=Monday - 7=Sunday
dow=`date +%u`
#hod = hour of day.
hod=`date +%k`

if [ $dow -le 5 ]
then
 #Weekday
 maxtime=3700

 if [ $hod -le 15 ]
 then
  #Quit out if before 16:00. Not going to continue running, so no xbox
  #logger xbox too early
  exit
 fi

 if [ $hod -ge 20 ]
 then
  #End of the day. Block the xbox
  /jffs/scripts/xbox/xboxstop.sh
  touch /jffs/scripts/xbox/xboxdailyflag
 fi

fi



if [ `wl -i eth5 assoclist | grep "C0:33:5E:D3:17:54" | wc -l` -eq 1 ]
then

 #If XBOX ON, increment seconds counter (in a file). Reset file to 0 each night.

 #read previous time, and add 5 mins (cron job runs every 5 mins)
 prevtime=`cat /jffs/scripts/xbox/xboxison`
 totaltime=`expr $prevtime + 300`
 echo $totaltime > /jffs/scripts/xbox/xboxison
 logger XBOX On $totaltime of $maxtime

 #if prevtime == 0 then xbox just turned on. Unblock it.
 if [ $prevtime -eq 0 ]
 then
  /jffs/scripts/xbox/xboxstart.sh
 fi

 #If $totaltime > Maxtime then block xbox
 if [ $totaltime -gt $maxtime ]
 then 
  /jffs/scripts/xbox/xboxstop.sh
  touch /jffs/scripts/xbox/xboxdailyflag
 fi

fi

admin@RT-AC86U:/jffs/scripts/xbox# cat xboxreset.sh 
#!/bin/sh

#Zero the counter file, clear the daily flag and block the xbox

logger xbox reset

echo 0 > /jffs/scripts/xbox/xboxison
rm -f /jffs/scripts/xbox/xboxdailyflag
/jffs/scripts/xbox/xboxstop.sh

admin@RT-AC86U:/jffs/scripts/xbox#
 
Similar threads
Thread starter Title Forum Replies Date
S RT-AX58U/RT-AX3000 Per IP Traffic Monitor Asuswrt-Merlin 2

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top