Pi-Hole on Docker using OMV Raspberry Pi 4 “Network Wide Ad-Blocker”

In this segment we are going to show you how to configure “Pi-Hole on Docker using Openmediavault Raspberry Pi 4 “Network Wide Ad-Blocker “

What is Pi-Hole ?

Pi-hole is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole (and optionally a DHCP server), intended for use on a private network. It is designed for use on embedded devices with network capability, such as the Raspberry Pi, but it can be used on other machines running Linux and cloud implementations.
Pi-hole has the ability to block traditional website adverts as well as adverts in unconventional places, such as smart TVs and mobile operating system adverts.

pihole

Please checkout Latest Pi-Hole article:

How to Install Pi-Hole on OpenMediaVault 5 inside Docker with Portainer using Raspberry Pi 4OpenMediaVault 5 on Raspberry Pi

OpenMediaVault Versions :

 

    EquipmentEquipment Required :

raspberrypi Raspberry Pi All Models
raspberrypi Micro SD Card “Minimum 8 GB”
raspberrypi Power Supply
raspberrypi Ethernet Cord for LAN Connection
raspberrypi External Hard Drive or USB Drive

     raspberrypiOptional :

raspberrypi Raspberry Pi Case
raspberrypi Keyboard
raspberrypi Mouse

Pi-Hole

Checkout official website : pi-hole

Docker-compose

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      TZ: 'Asia/Kolkata'
      # WEBPASSWORD: 'set a secure password here or it will be random'
    # Volumes store your data between container upgrades
    volumes:
       - './etc-pihole/:/etc/pihole/'
       - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

Step 1 : Configuring Openmediavault Network Interface

  • First of all we need to configure our DNS servers from Openmediavault Network Interface.
  • We need to navigate on Network –> Interfaces and edit the Network.
  • After that configure the DNS Server from Advanced settings to 127.0.0.1 or 1.1.1.1 as shown in Pi-Hole Docker-compose.

omv

Step-2 : Create Network for Pi-Hole

  • Now we need to open Docker and navigate to Networks then click on create for new network.
Network name  : "Type the name of your choice."
Network diver : "Select macvlan"
Subnet        : "Type Openmediavault IP Address/ Number of Address available on router"
Gateway       : "Type router IP Address"
Parent        : "Openmediavault Interface Name"

omv

Step 3 : Download the Official Pi-Hole Docker image.

  • We need to search for Pi-Hole container from the search box and chose the official Pi-Hole image.

Pi-Hole on Docker

Step 4 : Run Pi-Hole Image

  • Now, we need to select Pi-Hole image and click on run image.
  • After that fill the details as mentioned below the picture.

Pi-Hole

- General 
Container name : pihole "You can choose any name" 
Restart Policy : "always" 

- Networking 
Network mode : "Macvlan" 
Host name : PcMac "Choose a name of your choice" 

- Macvlan settings 
Select macvlan network : "Select the network which we have created" 
IP Address : "Type the IP Address for your Pi-Hole"

-Environment variables
ServerIP    : "Type the Pi-Hole IP Address, which we created"
TZ          : "Asia/kolkata", Type your Time Zone here
WEBPASSWORD : "Password of your choice"

- Volumes and Bind mounts
Create folder 1 : pihole
Create folder 2 : pihole/DNSmasq

- Extra arguments
-p 53:53/tcp -p 53:53/udp -p 67:67/udp -p 80:80/tcp -p 443:443/tcp

Step 5 : Access Pi-Hole Server Web Interface

  • To access the Pi-Hole web interface we need to type the Pi-Hole IP Address/admin.
  • But our Pi-Hole is not yet ready for blocking Ads on our Network.
  • To block the Ads on the Network we need to update Pi-Hole IP Address to our Router DNS.

Pi-Hole

http://Pi-Hole IP Address/admin/

Step 6 : Updating Pi-Hole IP Address to Router DNS

  • Now, we need to Login to our Router and then Navigate to DNS Settings.
  • Then we need to enter the Pi-Hole IP Address to our Router Primary DNS Address.
  • So, the traffic can route through the Raspberry Pi and Block ads with Pi-Hole.
Primary DNS Address   : "Pi-Hole IP Address"
Secondary DNS Address : "Cloudflare DNS Address i.e 1.1.1.1"

router DNS

Step 7 : Reset Pi-Hole Password

  • If you forgot your Pi-Hole password you can reset it anytime by using this command.
docker exec -it pihole pihole -a -p

Now, you are all set to use Raspberry Pi 4 as Pi-Hole Network Wide Ad-Block Server.
If you face any issue regarding this article please share your thoughts.
Enjoy using Pi-Hole on Docker using Openmediavault.

Smile (.”_”.)

Please checkout my other articles:

How to install OpenMediaVault 5 on Raspberry Pi All ModelsOpenMediaVault 5 on Raspberry Pi

OpenMediaVault 5 NAS Server on Raspberry Pi 4OpenMediaVault 5 on Raspberry Pi

Did you Like my Work ?

Please Like, Share and Subscribe our YouTube Channel.

Harish Kumar

As a founder of the PcMac YouTube channel and website, Our goal is to provide Free Technical help to people and spread knowledge to everyone.

This Post Has 3 Comments

  1. Avatar
    Ashlee

    Very good post. I’m going through msny of thbese issues as well..

  2. Avatar
    Santiago Visconti

    I love what you guys are usually up too. This kind
    of clever work and exposure! Keep up the terrific works guys I’ve
    incorporated you guys to my blogroll.

Leave a Reply