How to Install Pi-Hole on Your UGREEN NAS

How to Install Pi-Hole on Your UGREEN NAS

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.

💡Note: This guide works perfectly with the latest version of Pi-Hole v5.18.3 and UGOS PRO

  • 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.

Install Pi-hole UGREEN NAS Set up 1

  • STEP 3

Check the Enable box to Enable the SSH service on port 22, then click Apply. Follow the instructions in the image below.

Install Pi-hole UGREEN NAS Set up 2

  • 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.

Install Pi-hole UGREEN NAS Set up 3

  • 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.

Install Pi-hole UGREEN NAS Set up 4

  • 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.

Install Pi-hole UGREEN NAS Set up 5

  • 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.

Install Pi-hole UGREEN NAS Set up 6

  • 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.

Install Pi-hole UGREEN NAS Set up 7

  • 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.

Install Pi-hole UGREEN NAS Set up 8

  • 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.

Install Pi-hole UGREEN NAS Set up 8.2

  • STEP 11

Install Portainer using my step by step guide. If you already have Portainer installed on your UGREEN NAS, skip this STEP.

  • STEP 12

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.

Install Pi-hole UGREEN NAS Set up 9

  • STEP 13

Now create two new folders inside the pihole folder that you previously created at STEP 12 and name them pihole and dnsmasq.d Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Install Pi-hole UGREEN NAS Set up 10

  • STEP 14

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.

UGREEN NAS Portainer Add Stack

  • STEP 15

In the Name field type in pihole. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

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.)

Install Pi-hole UGREEN NAS Set up 11

  • STEP 16

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.

Install Pi-hole UGREEN NAS Set up 12

  • STEP 17

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Install Pi-hole UGREEN NAS Set up 13

  • STEP 18

Go back to STEP 1 or you will deal with karma 🙂

  • STEP 19

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 15. Click Log in. Follow the instructions in the image below.

Install Pi-hole UGREEN NAS Set up 14

  • STEP 20

Your Pi-hole dashboard at a glance!

Install Pi hole UGREEN NAS-Set up 5.18.3

  • STEP 21

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.

Install Pi-hole UGREEN NAS Set up 16

  • STEP 22

On your Windows 11 Desktop PC search for Settings. Once you find it, click Open. Follow the instructions in the image below.

Install Pi-hole UGREEN NAS Set up 17

  • STEP 23

On the left sidebar click Network & Internet. Select your Ethernet connection, then click the little arrow. Follow the instructions in the image below.

Install Pi-hole UGREEN NAS Set up 18

  • STEP 24

Scroll down until you find the option “DNS server assignment“. Click Edit. Follow the instructions in the image below.

Install Pi-hole UGREEN NAS Set up 19

  • STEP 25

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.

Install Pi-hole UGREEN NAS Set up 20

  • STEP 26

Go to Control Panel, then click on the Terminal icon. Follow the instructions in the image below.

Install Pi-hole UGREEN NAS Set up 1

  • STEP 27

Uncheck the Enable box on port 22, then click Apply. Follow the instructions in the image below.

UGREEN NAS Portainer Turn OFF SSH

Enjoy Pi-hole on Your UGREEN NAS!

🆘TROUBLESHOOTING

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 2STEP 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.

Pi-hole UGREEN NAS Portainer VPN permit all origins

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 Sunday / July 14th, 2024 at 3:04 AM