Use Pi-Hole to block ads on all devices in your network
Sure ad blockers have been around for a long while now, but those are typically only available for your web browsers and not ever device allows you to install them such as cell phones, media players, smart TV’s, etc. I came across a neat project that allows you to block web ads on every device in your network, called Pi-Hole.
In a nutshell Pi-Hole was developed to run on a Raspberry Pi, but will run on most any Debian based distro, and will act as a DNS server to which you point your devices or router to use as the DNS server so that all requests are filtered through Pi-Hole. Pi-Hole then blocks 100’s of thousands ad domains. All without having to use a single browser extension and for FREE!
So while Pi-Hole is made to run on a Raspberry Pi I decided to run Pi-Hole within my VMware home lab on a Ubuntu 16.04 LTS virtual machine using 1 vCPU and 1GB memory.
Below are the steps I performed to install Pi-Hole after I had Ubuntu installed on the VM.
How to install Pi-Hole on Ubuntu
- Lets start off making sure our Ubuntu install is updated so type in the following command:
sudo apt-get update && sudo apt-get upgrade -y
- Lets get the Pi-Hole script and save it as pihole-install.sh by typing the following:
sudo wget -O pihole-install.sh https://install.pi-hole.net
- It’s best practice not to blindly run any script you download from the internet and at least give it a quick look over, so lets open it in nano:
sudo nano pihole-install.sh
- After you’re done looking at pihole-install.sh simply press CTRL+X to exit nano.
- Now we need to make pihole-install.sh executable by typing:
sudo chmod +x pihole-install.sh
- Start the Pi-Hole installer:
- Press ENTER at the introduction screen.
- Press ENTER again to start configuring the network settings.
- Select the network adapter you want to use and press ENTER.
- Select which protocols you want to block ads.
- Next you can configure a static IP for Pi-Hole. I’ll use the current settings and select YES.
- Now select which upstream DNS service you want to use with Pi-Hole.
- Pi-Hole is now installed and ready for use. Either update all your devices DNS settings to your Pi-Hole IP or simply set your Router DNS to the Pi-Hole server IP.
Once you’ve changed your devices or router to use Pi-Hole as the primary DNS server you are essentially done and will no longer see any ads. If you want to enable/disable pi-hole ad blocking or whitelist certain ad domains then you can easily do so by accessing the Pi-Hole admin panel by going to: http://<PIHOLE_IP>/admin
They also give you a cool dashboard to see just how many ads Pi-Hole has been blocking for you and other stats – very neat stuff!
Check out the Pi-Hole website here and donate to help them out!
I’m amazed this guide hasn’t gained more popularity considering its noob-friendly, curl-command-avoiding benefits. Took so long to find out the safest, most straightforward way to go about installing this.
Thanks for the positive feedback @disqus_Rv9qSvT6UX:disqus. Feel free to spread the word. ;)
Looks great! How does it behaves on web sites that blocks you if you have an adblock ?
@disqus_V450ceqG3H:disqus I can’t say for sure as I’ve either never ran into a web site that blocks you entirely for adblock or maybe I have and just never been effected by it. Got a website in mind that I can test for you?
Fortune.com and Forbes.com are good examples.
Both work fine, here are screen shots of both sites from a computer behind the PiHole. Ads are gone and both sites load fine. :)
i installed it in a vm as you suggested, but my pi hole is working only inside vm. Not even on my host or any other machine. i am able to ping that ip address but could not launch pihole admin. any other settings do i need to do?
If you’re unable to access http://ip-of-pihole/admin then it sounds like something went wrong. You can try to run
in the command line.
Tha k you for this simple step by step instruction using a VM. One of these says I’ll get an actual pi, but this will suit just nicely until then. Many thanks once more!