Pi-Hole seems a great project to protect children. I have one setup for my 7 year old using OpenDNS with OpenDNS profiled to block Porn, violence, drugs etc. This works great. I would like to add a cron job to stop resolving at bedtime and resume in the wee hours of the morning so internet is blocked altogether. I would appreciate what the command would be to turn off the internet for this period.
THANKS...
Pi-Hole cannot turn off the internet service. You can toggle Pi-Hole DNS blocking off/on, but this just disables the blocking feature and does not stop internet access or DNS resolution.
One solution would be a router that has functions to block internet access by MAC address or client IP.
Another option is to write a cron to power down the Pi in the evening (which would block internet access for those clients using it for DNS resolution), but you would need to manually power it up in the morning. If you ran the cron to power it down, you could power it back up with a smart switch. Turn off the smart switch shortly after the Pi powers down and turn on the smart switch early am and the Pi will reboot on restoration of power. You would need to coordinate the shutdown prior to power off of the switch, as Pi's don't respond well to sudden power loss in all cases.
The smart switch idea is a very good one and I may do this.
If all dns requests can be handled like ads between certain times effectively blocking internet traffic that would be a great option if possible.
I can’t replace my router, I use pfSense and need my VPN’s and other protections.
Thanks for a great suggestion.
Have you checked to see if you can do this with pfSense? Set up a complete firewall block for a specific client in a specific timeframe? I don't run pfSense so I'm not completely familiar with what it can do.
Supposedly the Disney Circle program lets you do that, but I'm not sure if you can use that and pi-hole at the same time. Also, OpenDNS does not block all offensive sites. There is a specific domain which I won't mention that has offensive pages in among the legitimate content. I'm looking for a way to block it directly, because OpenDNS refuses to block it at the domain level and can't block the pages.
This looks like it would help with your requirements.
https://www.netgate.com/docs/pfsense/book/firewall/time-based-rules.html
If powering down the pi would work, but require manually turning back on, would it not just be easier to have a script that turns off the network connections themselves, ethernet and wifi, between certain hours. The raspi is effectively off then for devices trying to connect but you won't have the ball ache of having to power it on each day.