Pi-hole is a local DNS server that sits on your Raspberry Pi. Though you can set up a Pi-hole server in multiple ways like docker, virtual machine, but having it on a Raspberry Pi is more practical, convenient and cost efficient way.
Pi-hole maintains a local database of Ad domains. It functions by filtering out those Ad domains when you try to load a website. That is, it allows everything to load normally except the requests made by recognized Ad-lists.
I have been using Pi-hole since a long time. Frankly speaking, it works very well on websites and almost everything on desktop machines. But, it may or may not work with mobile applications like prime videos, YouTube, etc. Those applications have different ways of bypassing any adblocking software, and they keep on evolving them. So, it is a hit or miss.
There are two models which you can follow. Both of them are functionally good, but model 2 appears to be more convenient. Model 2 is the one I have implement at my home network.
Now, that we have covered the basics, lets dig into the processing to setting it up. Just a head's up - its easier than you think!
I am using Raspberry Pi 3/4. But, you may use any version that you like. You can follow the along the installation process with me. But, all you need to so is copy-paste commands in the terminal and go through the instructions.
But before that,
If you want to follow along, you may have a look at the YouTube video I have made a while ago.
An easy way to find the ip address is to log into your router and it will show up there. Once you have the ip address you can connect to the raspberry pi via VNC or SSH. I am more of a GUI person so, I prefer to use VNC.
Though I have configured my system to use IPv6, yours will most likely show IPv4 for the first time. You'll you that ip for SSH or VNC. That will also be the Ip address for your Pi-hole web page (admin page).
For first time users, it better to turn off ipv6 to avoid conflicts.
curl -sSL https://install.pi-hole.net | bash
Ideally, anything reasonably close to your main router's ip address is fine. Say 10.0.0.2/3/4 or 10. Be careful about setting the ip address in the same subnet.
This is where I screwed up couple of times while I starting out with this setup. Though, there are numerous way in which you can configure your pi-hole but this is the most straight forward one.
After all, the sole purpose of this guide is to get things working with minimum hassle.
All you need to do in initial few steps is keep on pressing the "ENTER" key. Pi-hole is smart enough to figure out what your network configuration is and where it could sit comfortably.
After you are done installing the pi-hole, it provides you with the password for logging into the admin page. Please, Please note that down somewhere carefully. I had a tough time retreivng that password and that was an additional unnecessary work that no one wants to get into.
Once you are set with your Raspberry Pi, it's time to head onto your routers for configuring them to use your Pi-hole for resolving all the dns queries from your devices.
In your router page you might want to look for a field to set "custom DNS".
And if you you happen to use OpenWRT, it's right under
If you Pi-hole doesn't seem to work during testing phase, you might what to turn off IPv6 or delegate IPv6 requests to Pi-hole in similar way.
For logging into the Pi-hole admin page, you need to hit the following address from your web browser
For me it is 192.168.137.10 as you can see in the screenshot.
All you need to do is login to the page.
{ip address of raspberry pi}/admin
The best way to test whether pi-hole is working or not, is to head on to google with any random search, say "vacuum cleaner" or, head on to amazon.
By now you should be able to see changes in the green bar and blue bar of your admin panel (total queries and queries blocked).
If you still can't see changes, then something isn't working right. It has happened with me couple of times.
At this point you might want turn everything off and on again.
Give it another shot. If it's still not working, i have got you covered.
Head onto you Pi-hole admin panel.
So, you need to enable the DHCP server in your Pi-hole so that all your devices get register with Pi-hole itself.
This would solve most of such common issues.
Pi-hole works just fine out of the box. Pi-hole comes with a default Ad-list of about 100k. But, it doesn't block all the ADS. If you want to take your game to the next level, you can update your Ad-list to your liking. All you need to do is copy and paste a few lines from
https://firebog.net/
I personally prefer to add everything that ISN'T crossed out in Advertising Lists, Tracking&Telemetry Lists and Malicious lists. I have tried and this works very well for me. I tend to Suspicious Lists as it might not be that perfect.
Adding these additional domains will take your blocking list beyond 300k easily.
That being said, too much blocking isn't good. A massive blocklist could be more prone to false positives, which might obstruct you from accesses the sites that have nothing to do with the ADS.
So, for me, the sweet spot lies between 300k-500k.
All the files relevant to this project will be upload to my git. Feel free to have a look.
Let me know if you have any suggestions for me or if there is something better we could have done.