Pi-Hole Install, Results, and Resources / by Robert Walker

Pi-Hole is a custom DNS server designed specifically to block ads, trackers, and malware. Pi-Hole can run from virtually any always-on hardware, including a Raspberry Pi, old PC, NAS, or Cloud Service.

See https://pi-hole.net/ for more information.

Here I will discuss my installation process, some initial results, and some extra resources.


Installation

Difficulty: Easy, but you should know your network’s/router’s configuration. For example, what is the IP to access your router from? What is the subnet of your network? General linux command line knowledge is helpful, but not needed.

I chose to install Pi-Hole to a virtual machine on my FreeNAS system. This is ideal for me because my network-attached storage (NAS) is always on and has plenty of resources to handle Pi-Hole. The steps below assume you have a FreeNAS 11.2 (or other always-on virtual machine). You can use older versions of FreeNAS, but the screenshots will be different.

Step 1:

Download the Ubuntu Server 18.04 LTS ISO.

Step 2:

Copy the ISO onto your NAS storage.

Step 3:

Create a virtual machine on FreeNAS.

From the main menu, navigate to “Virtual Machines”. Click “Add”.

Give your VM a name (e.g., “MyPiHole”). Make sure that Start on Boot and Enable VNC are checked.

FreeNAS11.2VM3.png

Assign resources. At minimum it 2 CPUs and 1MB of RAM.

Assign hard-disk space. I chose 60GB, but that’s a lot. 16GB is about the minimum I would use.

Choose your network interface. Your MAC address should show up - I’ve blanked mine for privacy.

Choose the Ubuntu ISO from your drive.

Confirm your configuration and click “Submit” or go back and make changes.

Step 4:

Start the VM and connect through the VNC.

Step 5:

Select the installation. Select your language and keyboard configuration options. Select “Install Ubuntu”.

Step 6:

Configure DNS IP (IMPORTANT!!)

Setup your network configuration to use a static IP address so that your router always knows where to send DNS requests. When you come to the Network Connections screen, choose your network interface, choose Ipv4, and change it to “Manual”. Configure the options to match your network.

  • Subnet should be a CDN formatted IP address. For example, a default might be 192.168.1.0/8 if all of the IPs on your network would fall into the range 192.168.1.1 to 192.168.1.255.

  • Address is the IP address you want to use for your DNS (this must fall in your subnet). For example, 192.168.1.222.

  • Gateway is the IP of your router. For example, 192.168.1.1.

  • Name Servers are the IP addresses you want Ubuntu to use for DNS lookups. You can use any you want, for example Google DNS is 8.8.8.8 and 8.0.0.8 and Cloudflare is 1.1.1.1 and 1.0.0.1.

  • Search domains can be left empty.

Step 7:

Continue installation (most defaults are OK). You can use the entire drive space you allotted and it’s OK to erase all data (nothing on it to start with). Be sure to remember the username and password you assigned during installation.

Step 8:

Once installation is completed, disconnect from the VNC and stop the VM. Go to “Devices” from the three-dots menu of the VM and remove the CD drive. This will allow the system to boot into Ubuntu Server on restart.

Step 9:

Start the VM and connect through VNC again. You should reach the terminal and be asked for login. Go ahead and login with the user you setup during installation.

Step 10:

Make sure your network configuration is correct by trying to ping www.google.com. You should be able to get a response. If you do not, then you will first need to edit your network configuration file at /etc/netplan/<network configuration file here>.yaml.

Step 11:

After you confirm internet connectivity, update Ubuntu. Type:

sudo apt-get update

then

sudo apt-get upgrade

If prompted for your password, enter it. “sudo” stands for “super user do” and temporarily elevates your privileges to allow system changes. These commands are safe, but don’t generally “sudo” things unless you know what you’re doing.

Step 12:

Install Pi-Hole from the terminal. At the terminal prompt type:

sudo curl -sSL https://install.pi-hole.net | bash  

Pi-Hole should start installing right away. Setup Pi-Hole as you prefer (defaults are usually Ok). I prefer Cloudflare for DNS because of speed and privacy, but use whatever makes sense for you. Once done, write-down or copy the default password assigned to you.

Step 13:

Login to Pi-Hole to confirm it’s live by visiting <VM Static IP>/admin in your browser.

Step 14:

Configure your router to use Pi-Hole as your DNS. This will vary for each router, but a quick Google Search should come up with some easy instructions if your router supports it.


Congratulations! You now have a functional ad-blocking custom DNS server! You can test this by visiting some website known to run ads - most should not show up anymore! You may see a few “We had trouble loading…” or other placeholders. This means the ad request was blocked!


Results

After a few days of using Pi-Hole, I noticed that my Pi-Hole Dashboard shows about 35% of DNS requests blocked! Some ads from Facebook and Google still slipped through, especially from YouTube, but overall I’m happy with the initial results.

To block the YouTube ads that got through, I added the following RegEx to my blacklist:

(^r[[:digit:]]+(\.|\-+)[[:alnum:]]+\-+[[:alnum:]]+\.)(googlevideo|gvt1)\.com$  

Boom! No more YouTube ads.


Resources:

https://firebog.net/ contains additional lists you can add to Pi-Hole for extra privacy, blocking, etc. to fit your internet needs!