Set Up A Parental Control With Pihole

Pihole: If you have installed a Pihole in your network, you have probably quickly appreciated its qualities of ad blocker. If you still do not know what is pihole, I invite you to read this tutorial to be able to test it.

Set up a parental control with Pihole
Set up a parental control with Pihole

Set up a parental control with Pihole

So the rest of this post is for those who already use one in their network. At the risk of being called a despot, I share here a little trick to set up a parental control “low cost” very easy to implement.

Digging a little, the pihole options , I realized that it was possible to block or allow specific areas in the command line .

Example: facebook blocking
Run in a terminal on your pihole:

pihole –wild facebook.com

All DNS queries that include a domain with the word ” facebook.com” will be blocked. terribly effective! The “-wild” meaning ” wildcard “.
Beware if you immediately test access to facebook.com in a browser, think before emptying the Firefox cache :

shift + ctrl + r to empty

To allow access to facebook again:

pihole –wild -d facebook.com
-d -mode remove the domain from the list

But you tell me it is possible to do the same operation on the web in the nice dashboard of pihole, with 2 clicks of the mouse. Why bother with the bash line?

Scheduling blockages and site permissions

Quite simply, because the trick lies in being able to schedule permissions and blockages of domains . With 2 simple lines in the crontab like this:

0 22 * * 1 – 5 / usr / local / bin / pihole –wild facebook.com snapchat.com && / usr / local / bin / pihole updateGravity
0 08 * * 1 – 5 / usr / local / bin / pihole –wild -d facebook.com snapchat.com && / usr / local / bin / pihole updateGravity
These 2 lines registered in the crontab have the effect of temporarily blocking access to Facebook and snapshat from 22H to 08h in the morning . And this rule is valid whether you have a smartphone, tablet or pc.

In our example, we are targeting two social networks. We could add instagram.com, twitter.com, any domain of your choice: youtube, marmiton.fr, lequipe.fr etc …

To conclude

This is effective but I clearly brings me grimey methods some ISPs. ( Dns liars ). Ethics takes a hit! But good in general we see it down when we have teenagers connected H24.

I’m not a fan of parental control and to be honest I did not think I’d have to go through it. But the addictions to our screens are such, that this solution can be saving to make the habit of disconnecting when it is time to sleep. And I’m getting into it.

Obviously, for those who know a little about this system is easily bypassed by simply changing resolver address.

Leave a Reply

Your email address will not be published. Required fields are marked *