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 can block traditional website adverts as well as adverts in unconventional places, such as smart TVs and mobile operating system adverts.
Please checkout Latest Pi-Hole article:
How to Install Pi-Hole on OpenMediaVault 5 inside Docker with Portainer using Raspberry Pi 4
OpenMediaVault Versions :
Software Required :
Equipment Required | Optional | ||
Raspberry Pi 4 | Case | ||
SD Card | Raspberry Pi Keyboard | ||
Ethernet Cable | Mouse | ||
Power Adapter | |||
External HDD | |||
Shop now |
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.
Step-2: Create Network for Pi-Hole
- Now we need to open Docker and navigate to Networks then click on create for the 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"
Step 3: Download the Official Pi-Hole Docker image
- We need to search for a Pi-Hole container from the search box and chose the official Pi-Hole image.
Step 4: Run Pi-Hole Image
- Now, we need to select Pi-Hole image and click on the run image.
- After that fill the details as mentioned below the picture.
- 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.
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"
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
In conclusion
- 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.
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 |
Very good post. I’m going through msny of thbese issues as well..
Thanks
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.