Home Pi-Hole Setup & Results
Post
Cancel
Preview Image

Pi-Hole Setup & Results

Overview

After the evil-twin project, I continued to root machines on hackthebox/vulnhub and left my raspberry pi to collect dust, recently I randomly thought of my raspberry pi and wanted to put my raspberry pi to its full use again!

During my research for my Wi-Fi pentesting project, I stumbled upon pi-hole raspberry pi projects, at that point I thought that it could be really useful for me as I am unable to block ads on my phone/tv, however since it is not related to my project scope, I had to find another project. But now, I can finally try it out!

Prerequisite Tools

Pi-Hole Setup

OS Installation

  1. Select Raspberry Pi OS
  2. Select Settings at Bottom Right,
  3. Enable SSH, set username & password
  4. Eject SSD
  5. Plug SSD into Pi
  6. Connect ethernet cable
  7. Power on the Pi

Configure Static IP address for your Pi

  1. Login to your Router’s web interface
    • http://192.168.1.1
    • http://192.168.1.254.
  2. View local device to find out Pi’s assigned IP address
  3. SSH w/ your configured credentials
  4. View currently defined router
    • routers: 192.168.1.254
  5. View current DNS Server
    1
    
     sudo nano /etc/resolv.conf
    

    • nameserver: 192.168.1.254
  6. Modify dhcpcd.conf to configure our static IP address for your Pi
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
     interface <NETWORK>                     
     static ip_address=<STATICIP>/24
     static routers=<ROUTERIP>
     static domain_name_servers=<DNSIP>
    
     <NETWORK>:  wlan0(wireless)/eth0(wired)
     <STATICIP>: IP Address in the Upper Numbers of your DHCP range [Recommendation]
     <routers>:  Refer to Step 4
     <DNSIP>:    Refer to step 5
    

    • Save the file CTRL + X then Y, followed by ENTER
  7. Reboot
    1
    
     sudo reboot
    

Pi-Hole Installation

  1. Proceed to your SSH w/ your configured credentials
  2. Install Pi-Hole (one-liner)
    1
    
    curl -sSL https://install.pi-hole.net | bash
    
  3. Use the following settings
    1. YES - Set static IP using current values
    2. Choose your DNS Provider
    3. Select 3rd party list, just go with the suggested list
    4. On - web admin interface
    5. On - web server (lighttpd)
    6. On - Log queries
    7. 0 - Show everything
    8. Done
  4. Add additional blocklist
    1. Login to http://<Pi IP address>/admin
    2. Proceed to Group Management > Adlists
    3. Proceed to firebog, copy links that are highlighted in green
    4. Paste them in Address, under Add new adlist
    5. Click online to update your gravity list, and you’re done!

DNS Server

  1. If you have the option to set your DNS Server on your router, change it to your Pi’s IP Address
    • Unfortunately my router does not allow me to do so, so I will have to manually set the DNS Server of my devices

Results

  • Youtube:
    • Unfortunately, due to how youtube ads works, it does not work for youtube.
  • Streaming sites, it works really well!
    • For e.g., when you click on the play button, an ad pops up and forces you to open another tab and sometimes even redirects you to another application!
    • Or there are so many ads that you cannot even see the panels/video.
    • Demo:
This post is licensed under CC BY 4.0 by the author.

HackTheBox - Shared

HackTheBox - Lame

Comments powered by Disqus.