Pi-hole on a Raspberry Pi and a DLink DIR-850L Router
This is old news already, everybody is using using Pi-hole these days to block ads before they enter your house at the DNS level, as an exercise program for the fat web or as a trustworthy replacement for the ad blockers. There are a lot of resources and discussions about it so this is by no means yet another post about how to use it or how cool it is. To the point, this is about a short list of resources about how to install and use it on a raspberry Pi with a DIR-850L router. I’ve started with these two articles: Setup Pi-hole on Raspberry Pi connected to D-Link DIR-850L router and Setting up Pi-hole: Step-by-Step Instructions (Part 2) and ended up with three simple steps:
-
(Prerequisite) have a Raspberry Pi prepared. I had a Raspberry Pi 3 Model B+ already prepared and waiting to be used.
-
Install the Pi-hole on your pi as described on the Pi-hole site. Just follow the instructions and make sure that when asked to set up the Upstream DNS Servers you keep the DNS values that were already set up on your router. On this point your almost ready to go, you just need to befriend it with your router.
-
(optional) Try it on with only one device. Just apply the option 3 from here to change the DNS server only on one of your devices in your network to use the Pi-hole.
-
Enable DHCP on your Pi-hole and disable it on your router as described on Step 6 here and on Step 5 here
- Just go to your admin page: http://pi.hole/admin/settings.php?tab=piholedhcp and check the DHCP server enabled checkbox
- Log into your router settings and disable DHCP. Make sure to do this after you enabled it on your Pi-hole, otherwise you will risk to make your router/pi-hole inaccessible.
You can stop here or you can tweak some settings. A good article to start with: Pi Hole Configuration and Customization. Things that I did (to reduce the amounts of writes on the SD card and theoretically prolonging its life):
- Disabled logging Settings -> System
- Applied this suggestion: “By default, PiHole writes to an SQLite database file every minute. You can set it to write every hour or longer.”
sudo nano /etc/pihole/pihole-FTL.conf ## Add these two lines in the file: DBINTERVAL=60 MAXDBDAYS=7 ## Then Ctrl+O to save and Ctrl+X to exit the nano editor sudo service pihole-FTL restart
After using the Pi-hole for several days I can already see that more than 15% of my traffic were ads or other black listed domains: