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

  1. 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

    ubuntu ssh update system

  2. 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

    pi hole download script

  3. 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

    pi-hole view script

  4. After you’re done looking at pihole-install.sh simply press CTRL+X to exit nano.
    pi-hole close view script
  5. Now we need to make pihole-install.sh executable by typing:
    sudo chmod +x pihole-install.sh

    pi-hole chmod script

  6. Start the Pi-Hole installer:
    sudo ./pihole-install.sh

    pi-hole install script

  7. Press ENTER at the introduction screen.
    pi-hole install 1
  8. Press ENTER again to start configuring the network settings.
    pi-hole install 2
  9. Select the network adapter you want to use and press ENTER.
    pi-hole install 3
  10. Select which protocols you want to block ads.
    pi-hole install 4
  11. Next you can configure a static IP for Pi-Hole. I’ll use the current settings and select YES.
    pi-hole install 5
  12. Now select which upstream DNS service you want to use with Pi-Hole.
    pi-hole install 6
  13. 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.
    pi-hole install 7

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

pi-hole admin panel

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!

Similar Posts

  • VMware ESXi 5 home lab upgrade

    In the past I’ve been using a single server to run my VMware ESXi home lab. it was slow, old, big and loud. I’ve been meaning to upgrade my home lab for a while and just never got around to it, until now! When looking for new hardware I wanted the servers to be as compact as possible, quiet, and low energy usage as possible while still having some horsepower.

    I debated on going the whitebox solution as I build all my own desktops anyway, I also looked at several other solutions such as the HP ML310e server, Shuttle XH61V barebones machine, but ultimately decided to go with two Intel NUC i5’s.

    Intel NUC i5 and 16GB ram

    Intel NUC i5 DC53427HYE Features:

    • Uses very little energy
    • Completely quiet
    • Supports up to 16GB RAM
    • A dual core CPU that scores nearly 3,600 in PassMark benchmarking
    • Includes vPro which allows me to easily run both NUC’s headless
    • Extremely small, nearly 4 1/2″ inch square footprint

    Read More “VMware ESXi 5 home lab upgrade”

  • How to use Site Recovery Manager DR IP Customizer

    As one of the tasks given to me include protecting critical virtual machines via Site Recovery Manager (SRM) I ran into an environment that needed to be protected and have static IP’s assigned to them. The environment consists of about 15 VM’s, all of the VM’s each have 5 NIC’s with two of the VM’s having 9 NIC’s – that’s a lot of NIC’s to manually configure on both the Protected and Recovery side in SRM.

    Looking through the SRM Documentation I was able to see that VMware has graced us with a wonderful tool to greatly speed up this process, dr-ip-customizer.exe!

    How to use VMware DR-IP-Customizer

    Read More “How to use Site Recovery Manager DR IP Customizer”

  • How to install Ubiquiti UniFi controller on the cloud

    Recently I replaced my wireless router, an Asus RT-AC66U, with an Ubiquiti EdgeRouter X router and Ubiquiti UAP-AC-LR access point. Both of which are a HUGE step up over traditional consumer wireless routers.

    The Ubiquiti access points use software called the Ubiquiti UniFi controller to configure and control the access points which can be installed locally or in the cloud – allowing you to manage the access points no matter where they are located.

    To automate the install process, I created a simple script to deploy the Ubiquiti UniFi Controller in the cloud on a Ubuntu server, and have also tested the script on three popular VPS providers: Linode, Vultr, and DigitalOcean – all three worked perfectly!

    Read More “How to install Ubiquiti UniFi controller on the cloud”

  • How to add Realtek R8168 to ESXi 5.5 Update 2 ISO

    Realtek

    Over the past weekend I was working on a whitebox ESXi host and wanted to upgrade it to ESXi 5.5 Update 2 from an older version of ESXi 5.1 using a realtek R8168 network card. While I could have performed an in place upgrade, such as via command line, a clean install was preferred. However, VMware has removed a number of NIC drivers from ESXi 5.x and trying to install with the base ESXi image would result in a “No Network Adapters” error during install.

    In order to do a clean install you have to re-add the Realtek R8168 NIC drivers back into the ESXi 5.5 image, otherwise a NIC will not be found and thus ESXi will not install. These are the steps to easily re-add the Realtek R8168 drivers into ESXi 5.5 ISO by making a custom ESXi 5.5 image.

    Read More “How to add Realtek R8168 to ESXi 5.5 Update 2 ISO”

  • My VMware ESXi Home Lab Upgrade

    Although the focus in my career right now is certainly more cloud focused in Amazon Web Services and Azure, I still use my home lab a lot.

    For the last 5+ years my home lab had consisted of using 3x Intel NUC’s (i5 DC53427HYE), a Synology NAS for shared storage and an HP ProCurve switch. This setup served me well for most of those years. It has allowed me to get many of the certifications I have, progress in my career and have fun as well.

    At the start of this year I decided it was time to give the home lab an overhaul. At first I looked at the newest generation of Intel NUC’s but really wasn’t looking forward to dropping over $1,300 on just partial compute (I’d still need to be RAM for each of the 3 NUC’s). I also wanted something that just worked, no more fooling around with network adapter drivers or doing this tweak or that tweak.

    I also no longer needed to be concerned about something that had a tiny footprint. I also questioned if I really needed multiple physical ESXi hosts. My home lab isn’t running anything mission critical and if I really wanted I could always build additional nested VMware ESXi hosts on one powerful machine if I needed.

    So in the end, the below is what I settled on. Replacing all of my compute, most of my networking and adding more storage!

    Read More “My VMware ESXi Home Lab Upgrade”

  • Microsoft’s Convenience Update breaks VMware VMXNet3 vNICs

    Microsoft recently pushed out a “Convenience Update“, a sort of rollup of rollups for Windows Server 2008 R2 SP1 and Windows 7 machines. This “Convenience Update” however comes with an incompatibility issue with VMware virtual machines that are using VMXNet3 network adapters, which causes the network to become unresponsive.

    Read More “Microsoft’s Convenience Update breaks VMware VMXNet3 vNICs”

Leave a Reply to Stibbons Cancel reply

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

9 Comments

  1. 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.

    Kudos

    1. @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?

  2. 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?

  3. 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!