Pi-Hole who hasn't heard of it?

You might have heard it first coming from LinusTechTips or searched a way to block advertisements on your home network. In my case i wanted to block advertisements and certain bad websites that contain trojans and viruses so this way i can keep my network a little saver while having less advertisements on forums, blogs and what not.

How does Pi-Hole work? it's an DNS server which associates various information with domain names and filters out ads before they are reaching your device so basically an intermediary between your prefered DNS in my case everything goes to Cloudflare and your whole network if you configure it that way.

Some things Pi-Hole offers:

  • Network-wide protection.
  • Block in-app advertisements.
  • Improve network performance.
  • Monitor statistics.
  • VPN possibility.
  • Automatic speedtests every hour.

As you can see my internet connection is not the most stable and Pi-Hole knows about it. you can easely add blocklists or add websites to whitelists i have quite some domain in my blocklist as you may have noticed.

Installation on Ubuntu

The best way and the way i did it is to install Pi-Hole on an Ubuntu server i already had running. Here is a mini guide.

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

And follow anything that pops up, don't forget to note the password you can change it later (pihole -a -p To reset the password), after that access Pi-Hole through http://pi.hole/admin/
if for some strange reason that doesn't work type in the machines ip addres like this http://IP_ADDPRESS_OF_YOUR_PI_HOLE/admin/ and we can now access Pi-Hole.

Speedtest on Pi-Hole

To install Speedtest add-on to pi-hole is a little tricky, first we need to install speedtest cli:

  • curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
  • sudo apt-get install speedtest

Now we can verify that it's working by typing speedtest in terminal after getting the speedtest results we can install this module into pi-hole.

Backup original admin folder just in case.

  • sudo su
  • cd /var/www/html
  • mv admin org_admin
  • git clone https://github.com/arevindh/AdminLTE admin

Get latest webscripts file.

  • cd /opt/pihole/
  • mv webpage.sh webpage.sh.org
  • wget https://github.com/arevindh/pi-hole/raw/master/advanced/Scripts/webpage.sh

Copy Databasefile.

  • cp /var/www/html/admin/scripts/pi-hole/speedtest/speedtest.db /etc/pihole/

Now go to the settings page in pi-hole and Set speedtest schedule and Display range Tick Flush speedtest history (for the first time only) Set speedtest mode to Official CLI.

Don't forget to add some blocklists it comes with a standard list which blocks some things not everything, also re-route your Router's primary DNS to Pi-Hole else it wont do anything. Enjoy Pi-Hole.