In this segment, we are going to show you how to configure “Pi-Hole on Docker with Portainer using OpenMediaVault 5 Raspberry Pi 4 “
What is Pi-Hole?
Pi-hole is a free and open-source network-wide adblocker. This allows traffic to pass through its DNS server and block the predefined queries from the internet. It is based on Linux network-level advertisement and Internet tracker blocking the application.
OpenMediaVault Versions :
OpenMediaVault 5 Installation Guide :https://pcmac.biz/openmediavault-5-on-raspberry-pi/
Software Required :
|Raspberry Pi 4||Case|
|SD Card||Raspberry Pi Keyboard|
We may earn a commission for purchases using our links. Learn more.
Checkout official website: pi-hole
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 - 220.127.116.11 # 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
Note: Please change the OMV default port from 80 to something else and then start with
sudo apt update sudo apt dist-upgrade
Configuring Openmediavault Network Interface
- First, we need to configure our DNS servers from Openmediavault Network Interface. Here we need to navigate to Network –> Interfaces and edit the Network.
- However, we need to configure the DNS Server from Advanced settings to 127.0.0.1 or 18.104.22.168 as shown in Pi-Hole Docker-compose.
Create Macvlan Network for Pi-Hole
- Once the DNS is successfully configured then we need to open Putty and login to our OpenMediaVault with root user.
- After that, enter the below-given command to create Macvlan network for Pi-Hole. Remember to change the subnet to your OpenMediaVault IP Address.
docker network create -d macvlan \ --subnet=192.168.1.10/24 \ --gateway=192.168.1.1 \ -o parent=eth0 pub_net
Configure Pi-Hole container
- Once the image is successfully downloaded then we need to navigate to Containers and then click on Add container.
- After that, fill the details as mentioned below in the picture, Choose a name for your container and image name as pihole/pihole:latest.
Note: If you came across Port 53 bind error use the below-given command.
sudo systemctl disable systemd-resolved.service sudo systemctl stop systemd-resolved
- Finally, once everything is done we can go ahead and click on Deploy the container.
Access Pi-Hole Server Web Interface
- To access the Pi-Hole web interface we need to type the Pi-Hole IP Address/admin.
- However, our Pi-Hole is not yet ready for blocking Ads on our Network. We need to update Pi-Hole IP Address to our Router DNS.
http://Pi-Hole IP Address/admin/
Updating Pi-Hole IP Address to Router DNS
- At this moment we need to log in to our Router, then Navigate to DNS Settings.
- After that, we need to enter the Pi-Hole IP Address to our Router Primary DNS Address.
- Finally, all the traffic will 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 22.214.171.124"
Reset Pi-Hole Password
- If you forgot the Pi-Hole password you can reset it anytime by using this command inside Terminal.
docker exec -it pihole pihole -a -p
- Above all steps will convert your 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 check out my other articles:
- How to install OpenMediaVault 5 on Raspberry Pi All Models
- OpenMediaVault 5 NAS Server on Raspberry Pi 4
Did you find us helpful?
|Subscribe our YouTube Channel|
|Support us on Patreon|
|Like us on Facebook|
|Share This Article with others|