Setup Pi-Hole

1 minute read

Description:

So after setting up my PI, I installed Pi-hole for my network on it.

To Resolve:

  1. First you ssh to it:

    1
    2
    3
    4
    5
    
    sudo vi /etc/dhcpcd.conf
    # set static IP; save and exit
    # change to root
    sudo su
    curl -sSL https://install.pi-hole.net | bash
    
    • When I did this, the installer wasn’t able to continue because I had changed the IP address of the pi. I then had to modify /etc/dhcpcd.conf and /etc/resolv.conf to also point to 8.8.8.8 for DNS since it cleared it and set everything to only point to 127.0.0.1. I then re-ran the installer for it to setup completely.
  2. At the end of the install it gives you the admin password, copy it somewhere. Then type:

    1
    
    pihole -a -p
    
  3. Configure router to point to pi => This will vary from vendor to vendor but you typically login to your routers LAN interface in your web browser, then go to lan settings => and set the DNS server handed by DHCP to that of your pi-hole.

  4. Commands:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    pihole -b example.com => Adding a site to blacklist  
    pihole -wild example.com => Adding a site and all its subsites to blacklist  
    pihole -w example.com => Adding a site to whitelist  
    pihole -wild -d pubnub.com => Remove a blacklist  
    pihole -up => update it  
    pihole -c => shows stats  
    pihole status => shows stats  
    pihole -q hulu => to query a specific domain  
    pihole disable / enable => Self explanatory  
    pihole restartdns => restart dns server
    
  5. If you want to block Youtube, add the following to your blacklist section:

    1
    2
    3
    
    (^|\.)googlevideo\.com$
    (^|\.)youtube\.com$
    (^|\.)ytimg\.l\.google\.com$
    
  6. Recommended blocklists to add:
  7. Couple other commands I used to clean it up:

    1
    2
    3
    4
    
    sudo apt update
    sudo apt full-upgrade
    sudo apt clean
    apt -y purge "pulseaudio*"
    
    • Update: pihole -up

Tags:

Updated:

Comments