Pi-hole Setup
24 Jul 2019Pi-hole is network wide ad-blocking mechanism utilising a Raspberry Pi. It provides ad-blocking via a DHCP server and/or DNS Server.
Table Of Contents
- Requirements
- Installing an operating system onto the Raspberry Pi
- Enabling the Raspberry Pi for SSH connectivity
- Connect Raspberry Pi to the network
- Installing Pi-hole on the Raspberry Pi
- Testing the Pi-hole
- Configure devices on your network to use Pi-hole
- Issues I have encountered
Requirements
- Raspberry Pi
- Lan Cable (used to connect the Raspberry Pi to the router)
- 8gb SD card for the Raspberry Pi
- Power cable for the Raspberry Pi
- SD Card reader
Installing an operating system onto the Raspberry Pi
This step has vastly improved from when I first bought the device.
- Go to Raspberry Pi Downloads Section
- Download the recommended operating system’s zip file. At the time of writing I opted to install the recommended Raspbian OS.
- Follow the steps in the link provided to write an image to the SD Card. Installation Guide.
Enabling the Raspberry Pi for SSH connectivity
- Disconnect the SD Card and Reconnect it. You should now see 2 extra drives. A Boot Drive and a USB Drive.
- Navigate to the Boot Drive.
- On the root directory add an empy ssh directory
Connect Raspberry Pi to the network
- Install the SD card to the Raspberry Pi.
- Connect the Raspberry Pi directly to the router via the LAN cable you purchased.
- Plug the power cable in and wait.
Installing Pi-hole on the Raspberry Pi
- Log into your router.
- Find the IP Address for the Raspberry Pi.
- Reserve the IP Address for the Raspberry Pi via the MAC Address.
-
ssh into the Raspberry Pi using the following command:
ssh pi@<IP Address Here>
-
The default password for the raspberry pi is:
raspberry
- Change the password and store it somewhere safe. I recommend using a password manager.
- Follow the installation instructions here
- During the installation I just selected all the defaults.
Testing the Pi-hole
Once the installation has completed:
- Select a device connected to your home network and set the DNS of the device to the ip address for the Raspberry Pi.
- Navigate to a web page with heavy ad usage.
-
Navigate to
http://<Raspberry PI - IP Address>/admin
- Observe the ads being blocked for the site you visited.
Configure devices on your network to use Pi-hole
Follow the instructions here.
Issues I have encountered
Nest Cams not connecting
I have noticed that my nest cams have struggled to connect to the internet. It eventually fixed itself. I have however discovered several mitigations to solve this issue.
-
Re-enable the Router DHCP server until the nest cams are connected. The issue here I believe is when the IP Address lease expires I will encounter the same issue.
-
Add the nest cam devices to the dnsmasq list to exclude the devices from filtering. Follow the instructions by deathbybandaid here
Just incase the instructions are lost here is what was stated:
With the help of reddit, I managed to find a way to bypass the pihole straight to google 8.8.8.8 , It is set up by mac address.
Find the mac address and place this in your /etc/dnsmasq.d/ directory 273.
cd /etc/dnsmasq.d/
wget https://raw.githubusercontent.com/deathbybandaid/piadvanced/master/piholetweaks/dnsmasqtweaks/04-bypass.conf
nano 04-bypass.conf
(replace mac address)
dnsmasq --test
(tests the configuration)
sudo service dnsmasq restart
Or
sudo reboot
It would be awesome to do something like this via the webui!
Pi-hole dashboard is unreachable
The correct way to combat this issue as pain-free as possible is to:
- Re-enable the router’s DHCP service.
- ssh into the raspberry pi and restart it.
NOTE
If you just power-cycle the Raspberry Pi it may have trouble re-connecting to the router as I discovered. You will have to either directly connect a device via a LAN cable to the router or use a device that still has a valid IP address leased to it to perform the above steps.