Time base restriction on Youtube

Hi

I have two kids 12 and 14 and doing some restriction with internet access as per guidance here: KidSafe (or Guest) WiFi, Forced SafeSearch and Adblock
It's fine, however i would like to remove the restriction during weekend with crontab by modification the content of file: /etc/config/dhcp

Here is my dnsmasq during Mon-Fri:

config dnsmasq 'kidsafe'
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/kidsafe/'
	option domain 'kidsafe'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases.kidsafe'
	option resolvfile '/tmp/resolv.conf.kidsafe'
	option strictorder '1'
	option nonwildcard '1'
	list interface 'kidsafe'
	list notinterface 'lo'
	option cachesize '1000'
	option logfacility '/dev/null'
	list address '/google.com/216.239.38.120'
	list address '/google.ca/216.239.38.120'
	list address '/bing.com/204.79.197.220'
	list address '/bing.ca/204.79.197.219'
	list address '/youtube.com/216.239.38.120'
	list address '/m.youtube.com/216.239.38.120'
	list address '/youtubei.googleapis.com/216.239.38.120'
	list address '/youtube.googleapis.com/216.239.38.120'
	list address '/youtube-nocookie.com/216.239.38.120'
	list server '208.67.222.123'
	list server '208.67.220.123'

During Sat-Sun remove restriction by crontab

0 5 * * 6 uci set dhcp.@dnsmasq[0].address='/google.com/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/google.ca/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/bing.com/204.79.197.220' && uci add_list dhcp.@dnsmasq[0].address='/bing.ca/204.79.197.219' && uci commit dhcp && service dnsmasq restart

And on Sunday i have similar command to restore full setting of restriction:
0 22 * * 0 uci set dhcp.@dnsmasq[0].address='/google.com/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/google.ca/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/bing.com/204.79.197.220' && uci add_list dhcp.@dnsmasq[0].address='/bing.ca/204.79.197.219' && uci add_list dhcp.@dnsmasq[0].address='/youtube.com/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/m.youtube.com/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/youtubei.googleapis.com/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/youtube.googleapis.com/216.239.38.120' && uci add_list dhcp.@dnsmasq[0].address='/youtube-nocookie.com/216.239.38.120' && uci commit dhcp && service dnsmasq restart

It works but this approach is not good as it will write to router flash in period. Do you think that we can do the same thing by config in firewall? I already have time base restrict kids to access internet during night time 22:00-07:00 in firewall but cant' go further. Thank you.

Remove the uci commit that is all that should be needed to avoid flash writes.

2 Likes

it works perfect. thanks @jow

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.