Nearly all websites on the internet display ads to generate revenue. While I have nothing against people making money from the content on their websites, a number of the ad networks that are used contain an enormous amount of code designed to track browsing and target ads based on that browsing history. I feel quite uneasy when any organisation tries to gather an enormous amount of data about me so looked into creating a Pi Hole with my recently purchased Raspberry Pi.
When a website makes a request for content it makes a request to a DNS translate an URL into an IP Address (apple.com translates into 126.96.36.199). A Pi Hole works by intercepting these requests and; if the URL is listed on one of its blacklists, blocking unwanted requests.
Setting up a Pi Hole is easy; excluding download times it will take you around ten minutes. I decided to use Raspbian as my operating system and installed this first using NOOBS; initially I needed a mouse, keyboard, and display connected but enabled VNC and SSH so I was able to control my Raspberry Pi remotely.
The Pi Hole Github page lists multiple ways of installing Pi Hole using the command line, but I used the method of cloning the repository from Git Hub and then using the install script.
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole cd "Pi-hole/automated install/" sudo bash basic-install.sh
Once you have the install script running you’ll be shown a DOS style screen where you’ll be asked various questions; I’ll address some of the key ones.
A static IP address is required for a server, the installer will ask if you’d like to use its currently assigned IP address as its static IP address. Pi Hole will then assume that this will be its permanently assigned address, a key point to remember however is if you haven’t made this IP address a permanent assignment in your routers settings, your router may assign the Raspberry Pi a different IP at some point and your Pi Hole will stop working.
Once you’ve finished with the setup, if you’ve installed the web interface you’ll be able to easily view how much is blocked as well as what domains are most frequently blocked.
To configure your devices to use your Pi Hole you have three major options:
- On each device change your DNS server in the devices settings to the Raspberry Pi’s IP Address
- On your router change the DNS server to the Pi; if all your devices currently look to the router for DNS information they’ll go though the Pi for their DNS information.
- Configure your Pi Hole to also work as your DHCP server, meaning it instead of your router will assign IP addresses on your network
Option number three is probably the most complicated of all three and from what I have seen has no major advantage over option two. I chose to use option one as I have other users on my network and they would not find it easy to manage the Pi hole interface to resolve an issue with their browsing.
The effects of a Pi Hole on browsing have been huge. As you can see from the screenshot of my dashboard around 20% of my DNS queries are usually blocked; my all time percentage sits at 19.6% and that was from an installation at the end of October. I have only had an issue with one website not loading properly and in the months since installation.
I’ve always been quite cautious so in terms of security I can’t point definitively to a reduction in Malware, but I can see the potential of including blocklists that focus around malicious domains rather than just ad networks.