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. What is a DNS sinkhole? A DNS sinkhole, also known as a sinkhole server, Internet sinkhole, or Blackhole DNS is a DNS server that gives out false information, to prevent the use of a domain name. 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 like UGREEN NAS 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.
STEP 1
Please Support My work by Making a Donation.
STEP 2
Go toĀ Control Panel, then click on the Terminal icon. Follow the instructions in the image below.
STEP 3
Check the Enable box to Enable the SSH service on port 22, then click Apply. Follow the instructions in the image below.
STEP 4
Now open the Windows Command Prompt Client. Search for command prompt on your Windows PC. Follow the instructions in the image below. You can also use the PuTTY Client or Mac Z Shell (Client) if you are a Mac user.
STEP 5
On Windows 10 or 11, open Command Prompt or use PuTTY or Mac Z Shell and type in ssh yourUGREENASusername@yourUGREENASip -p22 then press Enter on your keyboard. Follow the instructions in the image below.
STEP 6
In Command Prompt, the message “Are you sure you want to continue connecting (yes/no)?” can sometimes appear. Type yes and then press Enter on your keyboard. Follow the instructions in the image below.
STEP 7
After you press Enter, you will be prompted to type in your UGREEN NAS password. Type it in, then press Enter on your keyboard. Follow the instructions in the image below.
STEP 8
Now type in:
sudo -i
Press Enter. After you press Enter, you will be prompted to type in your UGREEN NAS password. Type it in, then press Enter on your keyboard. Follow the instructions in the image below.
STEP 9
Now type in:
sudo killall dnsmasq
Press Enter. After you press Enter, the dnsmasq service will be deactivated on your UGREEN NAS which will allow you to unlock port 53. Follow the instructions in the image below.
STEP 10
Add Google DNS. Go to Control PanelĀ /Ā NetworkĀ /Ā General tab. Check āConfigure DNS server manuallyā and add on Preferred DNS Server:Ā 8.8.8.8Ā and on Alternative DNS Server:Ā 8.8.4.4 Click Apply. Follow the instructions in the image below.
STEP 11
InstallĀ Portainer using my step by step guide. If you already have Portainer installed on your UGREEN NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.
STEP 12
Add Read & Write Permissions to the Docker Folder. If you have already added the Read and Write Permissions to the Docker Folder, skip this STEP.
STEP 13
Go toĀ File Manager and open the docker folder. Inside the docker folder, create one new folder and name it pihole. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 14
Now create two new foldersĀ inside the pihole folder that you previously created at STEP 13 and name them piholeĀ and dnsmasq.dĀ Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 15
Log into Portainer using your username and password. On the left sidebar in Portainer, click on StacksĀ thenĀ + Add stack. Follow the instructions in the image below.
STEP 16
In the Name field type in pihole. Follow the instructions in the image below.
version: "3.9" services: pihole: image: pihole/pihole container_name: Pi-Hole mem_limit: 2g cpu_shares: 768 security_opt: - no-new-privileges:false restart: on-failure:5 network_mode: host volumes: - /volume1/docker/pihole/dnsmasq.d:/etc/dnsmasq.d:rw - /volume1/docker/pihole/pihole:/etc/pihole:rw environment: WEB_PORT: 8080 WEBPASSWORD: mariushosting WEB_BIND_ADDR: 192.168.1.152 TZ: Europe/Bucharest DNSMASQ_USER: root DNSMASQ_LISTENING: local
Note: Before you paste the code above in theĀ Web editor area below, change the value for WEBPASSWORD and add your own password. mariushosting is an example for a password, you should use your own password.
Note: Before you paste the code above in the Web editor area below, change the value for WEB_BIND_ADDR and add your own UGREEN NAS Local LAN IP. 192.168.1.152 is my NAS local LAN IP, you should use your own NAS local LAN IP.
Note: Before you paste the code above in the Web editor area below, change the value for TZ.Ā (Select your current Time Zone from this list.)
STEP 17
Scroll down on the page until you see a button namedĀ Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.
STEP 18
If everything goes right, you will see the following message at the top right of your screen: āSuccess Stack successfully deployedā.
STEP 19
Go back toĀ STEP 1Ā or you will deal with karma š
STEP 20
The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. Now open your browser and type in http://ugreennas-ip-address:8080/admin/login.php Type in the password you have previously created at STEP 16. Click Log in. Follow the instructions in the image below.
STEP 21
Your Pi-hole dashboard at a glance!
STEP 22
To change the theme to Dark Mode, click Settings on the Pi-hole left sidebar, then the Web Interface tab. Select Pi-hole midnight theme (dark), then click Save. Follow the instructions in the image below.
STEP 23
On your Windows 11 Desktop PC search for Settings. Once you find it, click Open. Follow the instructions in the image below.
STEP 24
On the left sidebar click Network & Internet. Select your Ethernet connection, then click the little arrow. Follow the instructions in the image below.
STEP 25
Scroll down until you find the option “DNS server assignment“. Click Edit. Follow the instructions in the image below.
STEP 26
Edit DNS settings. Instead of Automatic DHCP, choose Manual. Turn ON IPv4. Add your UGREEN NAS local IP then click Save. Follow the instructions in the image below.
STEP 27
Go toĀ Control Panel, then click on the Terminal icon. Follow the instructions in the image below.
STEP 28
Uncheck the Enable box on port 22, then click Apply. Follow the instructions in the image below.
Enjoy Pi-hole on Your UGREEN NAS!
Note: If your Pi-Hole status is red and not active,Ā something else is listening on the local DNS port 53. Since there is no option to disable the DHCP Server on your UGREEN NAS via Control Panel, it’s mandatory to disable the dnsmasq service as I explained in this article from STEP 2 to STEP 9. Every time you restart your UGREEN NAS, you need to redo STEP 2 – STEP 9 to make Pi-hole to run again. Right now, UGOS PRO is still in beta and there is no option to disable the DHCP Server via control panel. This is why STEP 2 – STEP 9 is necessary. I am confident there will be an option to disable the DHCP Server once UGOS PRO is out of beta. You can also permanently stop dnsmasq by using the following command: @reboot /usr/bin/killall dnsmasq
Fix: If you can’t play videos from CNN, in the Pi-hole whitelist add the following address: c.amazon-adsystem.com
Fix: How can I make Pi-Hole work over VPN connection? Go to Pi-Hole / Settings / DNS tab / Interface Settings / choose Permit all origins the scroll down the page all the way and click Save. Follow the instructions in the image below.
Fix: If someone has a problem once installation is completed, and gets an error like “This site can’t be reached“, open the Pi-hole GUI and go to Settings / DNS tab and in “Interface listening behavior” change to Listen on all interfaces instead of Listen only on interface eth0.
This post was updated on Wednesday / December 11th, 2024 at 3:50 PM