top of page
  • Writer's pictureJoel

How to install Pi-Hole on your Pi

Updated: May 11, 2020


Introduction

In this guide, we'll be showing you how to install Pi-Hole onto your Raspberry Pi. In case you happen to have stumbled on this post, and have no idea what Pi-Hole is, then let me explain.

Pi-Hole removes ads from your browsing experience on all devices in your network. It does this by intercepting DNS lookups, and blocking traffic that is known to contain ads. Pi-Hole comes with a very user-friendly dashboard, it's easily configured and can be disabled just the same, when ever you need to. We'll first show you how to install Pi-Hole, and then how configure.

We are using a Raspberry Pi B+ model, which is absolutely fine for this project, you can of course use later versions if you want to. We would advise that you don't use a Raspberry Pi that doesn't have an Ethernet port, as a wireless DNS server won't provide the best browsing experience for your devices.


Here's are the links to the things you'll need:


Let's get started...

 

Installing Rasbian Lite

  1. First you'll need to download the Raspbian Lite image from Raspberrypi.org onto

  2. Now go here to download Win32DiskImager and install. Run Win32DiskImager and browse for the image from Step 1. Now click 'Write'

  3. Once the image has been written to the SD card, you will be able to access the root partition of the SD card from your PC. Open this up and create a file with the name 'ssh'. Ensure that there are no extensions to this filename.


Tip

Hopefully, you'll already know what SSH is. If you don't, this is the most brief explanation we can provide in the scope of this guide: SSH allows you to connect to another device over your network, instead of having to plug-in a keyboard, monitor and mouse to your Raspberry Pi. You can simply open a program like PuTTY and completely configure your Pi from your Laptop, PC, or even a mobile app. So that's what we did in Step 3; enabled SSH.


Connect to your Pi and login

Insert your newly imaged SD card and fire up your Pi. You can connect to your Raspberry Pi using SSH. You will need to know the IP address of your Raspberry Pi 3 in order to do this. You should be able to find the IP address in your router's web based administration interface.


In this case, we'll use PuTTY to connect. Our Pi's IP address is 192.168.0.10:

The default username is pi and the password is raspberry. You MUST change the default password as soon as you login, if you don't you will very likely expose your entire network's device traffic to hackers and bot networks. Change the password by running the following:

$ sudo raspi-config
 

Installing Pi-Hole

First we need to update the APT package repository cache with the following command:

$ sudo apt update

Now we need to install GIT to be able to clone the Pi-Hole repository. To do this run:

$ sudo apt install git

With GIT installed, we can now clone the Pi-Hole repo, change to the install directory and then finally install Pi-Hole:

$ sudo git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
$ cd "Pi-hole/automated install/"
$ sudo bash basic-install.sh

The install wizard will now take you through some steps, which will require your input. There are a few notifications at the beginning that just need agreeing to.

Here are the options you'll need to choose:


  • Choose an interface: eth0

  • Upstream DNS provider: Google

  • Select protocols: IPv4 & IPv6

  • Static IP address: Choose an IP address that will not be used on your network for anything else

  • Gateway: This should be set to the IP address of your router

  • Web admin interface: On

  • Log queries: On

  • Installation complete: Take note of the admin interface address and the password that's been generated


Reboot your Raspberry Pi, with the following command:

$ sudo reboot
 

Configuring Pi-Hole

There are two things to consider before configuring Pi-Hole; do you want all devices on your network to automatically use Pi-Hole as their DNS server (in effect, blocking ads for all devices)? Or, do you want only certain devices to use Pi-Hole as their DNS server?

  • If you want the latter option, you will simply need to manually change the DNS server address in each device to the IP address of your PI hole. All other devices will use your router's settings by default.

  • If you want all devices on your network to automatically use Pi-Hole as their DNS server, you will need to disable DHCP on your router, and allow Pi-Hole to also be your DHCP server, as well as your DNS server.


If you've decided to use Pi-Hole for all devices and you're disabled DHCP in your router's web interface, then continue to read the remainder of this guide.


Login to your Pi Hole from a web browser by typing the Pi-Hole address in the following format. (Change the IP to your Pi-Hole's address): http://192.168.0.250/admin and enter the password you noted down at the end of the installion.


You should now see the following screen, click Settings:


Now go straight to the DHCP option and tick the 'DHCP server enabled' box then enter your router's IP address and click Save at the bottom of the page:


Most devices will automatically pick up the new DHCP & DNS settings fairly quickly, some may take a little longer. If you want to speed this process up a little, you can reboot the devices. The new settings should then take effect. Immediately, you will start to see queries being blocked in the web interface.

There are many additional options that you can utilise in Pi-Hole, such as Blacklisting and Whitelisting of certain addresses. Under the Disable option, for example, you can specify a duration to disable Pi-Hole, which takes effect immediately. Congratulations, you've installed and configured Pi-Hole on your network!


186 views0 comments

Recent Posts

See All
bottom of page