[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Limiting internet access by time



On Fri 05 Aug 2016 at 12:00:28 +0100, Lisi Reisz wrote:

> On Friday 05 August 2016 11:40:28 Brian wrote:
> >
> > How essential is this? cron could
> >
> >   ip route add default via <gateway_IP>
> >
> > at specific times between 9pm and 9am and then remove the default route.
> > If the machine isn't up all the time it seems unnecessary to me.
> 
> Perhaps he wants to stop his children/grandchildren/house guests surfing the 
> web at 3:00 am. 

Possibly.

Let us look at this from a different angle. If the machine is given a
fixed address it negates the need for dhcp checking, If, additionally,
no gateway to the internet is specified there would be no access to the
internet at any time.

For an always-on machine cron jobs could switch routing at 9am and 9pm.
If the machine was rebooted after 9pm there would be no internet. A
reboot after 9am presents a problem. This could be solved by having cron
check every five minutes between 9am and 9pm and providing a gateway to
the internet.

Sticking with the idea of using a systemd service file, the script it
runs would check the time and alter the routing table when necessary.
Neither cron nor iptables need come into the picture.


Reply to: