This post explains how I am using Pi-hole to block the internet for my TV 📺. I am using Pi-hole as parental control 👨👩👧👦.
Some time back I set up pi-hole on a Raspberry Pi in my home network to block advertisements.
~30% of my home internet traffic are tracking or advertisement. Now its all are blocked with #pihole pic.twitter.com/mRai9IBwgb
— arulraj.net (@arulrajnet) June 15, 2020
Now, I have reused it to block the internet for a specific device or domain.
My network
- The pi-Hole act as a DNS and DHCP server
- Main Router is just a WAN provider
- Route 8.8.8.8, 4.4.4.4 and 8.8.4.4 traffic to 192.168.1.53
- Youtube app or Android SmartTV doesn’t honor the DNS received via DHCP Offer.
- Thats why route all the DNS traffic to pi-hole
- Extender is to widen the coverage
Use case
At our home, TV time for the kids is mostly reserved for weekends. But once they start watching, getting them to stop can feel like a never-ending struggle. Forget asking for the remote; that’s practically impossible!
I needed a foolproof way to ensure the TV goes off after a set time without any arguments.
The Pi-hole came for rescue.
Hack
A little bit background on Pi-Hole.
- Its a DNS server with the advertisement domains list.
- Whenever a device try to resolve those domains, it returns as
0.0.0.0
- Its also acts as DHCP server
We are going to use the following resources to block internet.
- Groups - Its for grouping clients
- Clients - Every MAC address in the network as client and assign the client to a Group
- Domains - Custom whitelist or blocklist the domains and assign to a Group.
These are the steps we are going to do
- Create a group.
- Create domain. Add the domain to block and add that domain to group.
- Create client and assign that client to group.
Create a Group. This will used to add the blocklist client.
Here I have created group called Block_Internet
To block all internet for the particular device
Add a new block list domain.
Domains → Regex Filter
Regular Expression: .*
Comment: Block All
Click Add to Blacklist
Once added, change the group to Block_Internet
Now add the client to the group.
In my case whenever the TV time got over, I will add the TV
client into the list.
To block youtube
Add *.googlevideo.com
domain to the regex filter.
Things to Improve on Pi-Hole
- Time based restriction or group assignment
- domain list support for this kind of use cases
Final Thoughts
All this blocking works perfectly—until the day they discover VPNs. For now, they’re too young to figure it out. To them, it’s just “Dad’s magic.” 😆