User Tools

Site Tools


pi-hole:setup_pi-hole_running_in_a_container_on_qnap_container_station

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pi-hole:setup_pi-hole_running_in_a_container_on_qnap_container_station [2021/01/07 14:26] – [SSH into the Ubuntu LXC Container] peterpi-hole:setup_pi-hole_running_in_a_container_on_qnap_container_station [2021/04/21 22:00] (current) peter
Line 9: Line 9:
     * There are several types of Docker and LXC containers listed.     * There are several types of Docker and LXC containers listed.
   * Choose the **LXC** Ubuntu 18.04 container.     * Choose the **LXC** Ubuntu 18.04 container.  
-    * That's the underlying OS for the QNAP QTS Operating System on the NAS. +  * Name the container, such as "Pi-Hole" and set the CPU limit to 20% and the memory limit to 2048MB which should be sufficient for Pi-Hole
-  * Name the container "Pi-Hole" and set the CPU limit to 20% and the memory limit to 2048MB which is more than enough for Pi-Hole.+    * The memory can be set higher if needed.
  
 {{:pi-hole:pi-hole_-_container_settings.png?800|}} {{:pi-hole:pi-hole_-_container_settings.png?800|}}
  
 <WRAP info> <WRAP info>
-**NOTE:** We use an LXC container instead of a Docker container.+**NOTE:** LXC container is used instead of a Docker container.
  
-A Docker implementation will run perfectly until you either shutdown the container or restart the QNAP NAS.  Upon restart of the container, the console will indicate that there is no DNS Resolver available.  The community documented solution has been to edit /etc/resolv.conf of the QNAP to point to 1.1.1.1 (Cloudflare DNS) rather than to the router.  This seems to work inconsistently and is not a final solution.  Other suggestions online involve stopping the DNSMASQ daemon.  There is a better way, by using LXC in this case.+LXC containers are not just an application instance.  
  
-One powerful feature of Docker containers is that you can export them and import them easily on another Docker system. The limitation to Docker containers is that once you create one, it really can'be modifiedSo, in the case of "Pi-Hole", you would have to create a new container when a new version of Pi-Hole is released. That's because the Docker Image is an image.+  * An LXC Container runs an OS instance, such as Ubuntu, on which you can install one or more applications. 
 +  * The LXC container uses a minimal amount of system resources. 
 +  * The OS the container runs can easily be updated. 
 +  * The applications running in the OS can easily be updated. 
 +  * To update Pi-Hole is as easy as running the standard **pihole -up** command.
  
-LXC containers are not just an application instance.  LXC containers provide an isolated OS instance on which you can install one or more applications unlike a Docker instance which is for a single packaged installation. +Docker containers run a single application installation.
  
-Since LXC provides container instance of an OSit is possible to install one or more applications to an LXC container after creating it+  * A Docker Container is based upon package imageand are therefore not as easy to modify
- +  * To update Pi-Hole, you would have to create a new container when a new version of Pi-Hole is released.
-In order to provide an easier installation for pihole without the issues mentioned here, we will use an LXC container.+
 </WRAP> </WRAP>
-  
  
-Then click on **Advanced Settings**.+---- 
 + 
 +Click on **Advanced Settings**.
  
   * Change the network mode to **Bridge**.   * Change the network mode to **Bridge**.
-  * Select **Use Static IP** and change the IP address to a unique address on your LAN.  In this example, 192.168.1.25 is used.+  * Select **Use Static IP** and change the IP address to a unique address on your LAN. 
 +    * In this example, 192.168.1.25 is used.
  
 {{:pi-hole:pi-hole_-_container_settings_-_advanced_-_network.png?800|}} {{:pi-hole:pi-hole_-_container_settings_-_advanced_-_network.png?800|}}
  
-Go back to the **Overview** section in Container Station and after a few minutes you should see your container listed.+---- 
 + 
 +Return to the **Overview** section in Container Station and after a few minutes you should see your container listed.
  
-Click on the name of the container and you will enter the console.+Click on the name of the container, which will enter the console.
  
 Type **passwd** to change the password. Type **passwd** to change the password.
Line 51: Line 58:
 ===== Update and Configure the Ubuntu LXC Container ===== ===== Update and Configure the Ubuntu LXC Container =====
  
-Before we can install Pi-hole, we need to update this very lightweight LXC container to add some features.   +Update Ubuntu:
- +
-First run updates:+
  
 <code bash> <code bash>
Line 59: Line 64:
 </code> </code>
  
-Next install the ssh server:+Install the ssh server:
  
 <code bash> <code bash>
Line 65: Line 70:
 </code> </code>
  
-Now add a username other than the default. Just go through the dialogue and answer the prompts for the new user.+Add a username other than the default.  
 + 
 +<WRAP info> 
 +**NOTE:**  Simply answer the prompts for the new user. 
 +</WRAP>
  
 <code bash> <code bash>
Line 71: Line 80:
 </code> </code>
  
-Now grant the new user privilege:+Grant the new user root privileges:
  
 <code bash> <code bash>
Line 81: Line 90:
 ===== SSH into the Ubuntu LXC Container ===== ===== SSH into the Ubuntu LXC Container =====
  
-Open a terminal back on your desktop computer and "ssh" to the new machine with the address you used to create the LXC instance:+"ssh" to the new machine with the IP address that was used to create the LXC instance:
  
 <code bash> <code bash>
Line 99: Line 108:
 </code> </code>
  
-Now you can install pi-hole:+Install pi-hole:
  
 <code bash> <code bash>
Line 128: Line 137:
  
  
 +Select the defaults until the DNS screen and then choose Cloudflare as the DNS.
  
 +  * Accept all the rest of the defaults.
 +  * The installation will continue for a while.
 +  * When the installation completes, a message will be shown telling you to set up the DHCP settings on your router to make the address of your Pi-Hole the primary DNS for your network.
 +  * So log into your router and point the DNS settings to the IP address of this container.
  
- 
- 
- 
-Select the defaults until the DNS screen and then choose Cloudflare as your DNS. 
- 
-  * Accept all the rest of the defaults and be careful not to change them.  This will assure that you get the admin web interface and that statistics are logged. 
-  * The installation will continue for a few minutes after you answer the prompts. 
-  * After your installation completes, you will receive a message telling you to set up the DHCP settings on your router to make the address of your Pi-Hole the primary DNS for your network. 
-  * That will insert the Pi-Hole as the "man-in-the-middle" to scrutinize all DNS names before they are either passed to the Internet or "Pi-Holed". 
  
 When you return to the prompt in the "ssh" terminal session, enter the following command to set your Pi-hole password: When you return to the prompt in the "ssh" terminal session, enter the following command to set your Pi-hole password:
Line 146: Line 151:
 </code> </code>
  
-You can now close the "ssh" terminal session.+<WRAP info> 
 +**NOTE:**  The "ssh" terminal session can now be closed. 
 +</WRAP> 
  
 ---- ----
  
-===== Go to your Pi-Hole Website =====+===== Access the Pi-Hole Website =====
  
-Go to your web browser and enter the address of your Pi-Hole followed by /admin:+Within a web browserenter the IP address of your Pi-Hole followed by /admin:
  
 <code bash> <code bash>
Line 158: Line 166:
 </code> </code>
  
-Select the login and you should be able to log in with the password you just set.+Click **login** and you should be able to log in with the password you just set.
  
 <WRAP info> <WRAP info>
-**NOTE:**  Since this is a "scratch" install in an LXC container, you will be able to start and stop the container and reboot the QNAP NAS without any problems and even upgrade Pi-Hole when new releases are available. +**NOTE:**  You will be able to start and stop the LXC container and reboot the QNAP NAS without any problems and even upgrade Pi-Hole when new releases are available.
- +
-This LXC container is very lean and uses a minimal amount of system resources. +
 </WRAP> </WRAP>
  
  
 <WRAP important> <WRAP important>
-**IMPORTANT:**  Don'forget to set the DNS settings for your DHCP server on your router because Pi-Hole will not be used by any of your network clients until that occurs.+**IMPORTANT:**  Do not forget to set the DNS settings for your DHCP server on your router because Pi-Hole will not be used by any of your network clients until that occurs.
  
 A good practice is to make the Pi-Hole DNS 1 and then Cloudflare 1.1.1.1 as DNS 2. A good practice is to make the Pi-Hole DNS 1 and then Cloudflare 1.1.1.1 as DNS 2.
pi-hole/setup_pi-hole_running_in_a_container_on_qnap_container_station.1610029585.txt.gz · Last modified: 2021/01/07 14:26 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki