Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
virtualisation:pihole_lxc_container [2022/05/23 10:33]
cakir [Basic Installation Guide]
virtualisation:pihole_lxc_container [2022/05/24 09:28] (current)
cakir [Setup a Pi-hole in LXC container]
Line 1: Line 1:
-====== ​Setup a Pi-hole in LXC container ====== ​+====== Pi-hole in LXC container ====== ​
  
                                                                                                                                                                
Line 26: Line 26:
  
  
-===== Setup virtualization =====                      ​+===== Setup LXC Pi-hole ​virtualization =====                      ​
                                                                                                     ​                                                                                                     ​
 Before we can start please check if virtualization feature is licensed on your system (see SYSTEM -> Licensing on WebGUI). Before we can start please check if virtualization feature is licensed on your system (see SYSTEM -> Licensing on WebGUI).
Line 35: Line 35:
 **Step 1:** First we need a working WAN connecton to the Internet. Make sure DNS names get resolved correctly. ​                         ​ **Step 1:** First we need a working WAN connecton to the Internet. Make sure DNS names get resolved correctly. ​                         ​
                                                                                                     ​                                                                                                     ​
-**Step 2:** On the Web-GUI navigate to SYSTEM -> Virtualization and click the small plus icon to create a new virtualization. Here we navigate to the Networking tab and pick bridged. We leave the interface at LAN1 and click the Apply button.+**Step 2:** On the Web-GUI navigate to SYSTEM -> Virtualization and click the small plus icon to create a new virtualization. Here we navigate to the Networking tab and pick ''​bridged''​. We leave the interface at LAN1 and click the Apply button.
  
 {{:​virtualisation:​02-pihole-bridged.png}} {{:​virtualisation:​02-pihole-bridged.png}}
  
-**Step 3:**  We switch to the Install tab and paste the following link "''​https://​share.netmodule.com/​router/​public/​virt/​pihole.tar.xz''"​ to the URL field. Also check the box for Install on "​Apply",​ then hit the Apply button. Now is the right time to grab a coffee or tea, this step can take some time to compelte (around ​minutes).+**Step 3:**  We switch to the Install tab and paste the following link "''​https://​share.netmodule.com/​router/​public/​virt/​pihole.tar.xz''"​ to the URL field. Also check the box for ''​Install on "​Apply"​''​, then hit the Apply button. Now is the right time to grab a coffee or tea, this step can take some time to compelte (around ​minutes).
  
 {{:​virtualisation:​03-pihole-install-tarxz.png}} {{:​virtualisation:​03-pihole-install-tarxz.png}}
                                                                                                     ​                                                                                                     ​
-**Step 4:** We are now back at the Virtualization main page and set the Administrative status to enabled ​the hit the Apply button one more time.+**Step 4:** We are now back at the Virtualization main page and set the Administrative status to ''​enabled''​ then hit the Apply button one more time.
  
 {{:​virtualisation:​04-pihole-enable.png}} {{:​virtualisation:​04-pihole-enable.png}}
  
  
-===== Setup router =====+===== Setup router ​DHCP/​DNS ​=====
                                                                                                                                            
 We are now back at the router Web-GUI to do the final setup of the DHCP server and DNS settings. ​                           We are now back at the router Web-GUI to do the final setup of the DHCP server and DNS settings. ​                          
                                                                                                     ​                                                                                                     ​
-**Step 1:** Navigate to SERVICES → DHCP Server and click the Edit button. Pick the specify radio button which will make some additional input windows pop up. Here you have to put the address you want the pi-hole to server to have in the Primary DNS field. Note that the address will have to be within the range of the DHCP server settings, for example 192.168.1.111,​ then click Apply. ​+**Step 1:** Navigate to SERVICES → DHCP Server and click the ''​Edit'' ​button. Pick the specify radio button which will make some additional input windows pop up. Here you have to put the address you want the pi-hole to server to have in the Primary DNS field. Note that the address will have to be within the range of the DHCP server settings, for example ​''​192.168.1.111''​, then click Apply. ​
  
 {{:​virtualisation:​01-pihole-dhcp.png}} {{:​virtualisation:​01-pihole-dhcp.png}}
                                                                                                     ​                                                                                                     ​
-**Step 2:** Click the Edit button one more time so we can setup the pi-hole as static host. Once again we click the small plus icon and set IP address to the one you picked earlier (192.168.1.111 in my case) and MAC address to 00:​ff:​aa:​00:​44:​00 (this is the AMC address of eth0 in the virtualization).+**Step 2:** Click the Edit button one more time so we can setup the pi-hole as static host. Once again we click the small plus icon and set IP address to the one you picked earlier (''​192.168.1.111'' ​in my case) and MAC address to ''​00:​ff:​aa:​00:​44:​00'' ​(this is the MAC address of eth0 inside ​the LXC virtualization).
  
 {{:​virtualisation:​02-pihole-static-host.png}} {{:​virtualisation:​02-pihole-static-host.png}}
                                                                                                     ​                                                                                                     ​
-**Step 3:** To finalize the setup do a reboot of the router. You can do this by navigating to SYSTEM → Reboot and the hit the Reboot Now button or alternatively just run the reboot command in terminal.+**Step 3:** To finalize the setup do a reboot of the router. You can do this by navigating to SYSTEM → Reboot and the hit the ''​Reboot Now'' ​button or alternatively just run the ''​reboot'' ​command in terminal.
  
 {{:​virtualisation:​03-pihole-reboot.png}} {{:​virtualisation:​03-pihole-reboot.png}}
                                                                                                     ​                                                                                                     ​
-**Step 4:** To verify that everything is working correctly open then pi-hole web interface by visiting http://​192.168.1.111/​admin/​ with your browser. The default admin password after installation is "​admin01"​. **We strongly recommend to change the password after verifying sucessfull installation.** (see next step)+**Step 4:** To verify that everything is working correctly open then pi-hole web interface ​login page by visiting ​''​http://​192.168.1.111/​admin/​index.php?​login'' ​with your browser. The default admin password after installation is "​admin01"​. **We strongly recommend to change the password after verifying sucessfull installation.** (see next step)
  
 {{:​virtualisation:​04-pihole-gui.png}} {{:​virtualisation:​04-pihole-gui.png}}
  
-**Step 5:** To change the password we need to access the router ​via terminal. Log in via ssh, telnet or serial connection and then run the command "''​lxc-attach guest0''""​ then run the command ​for changing the password ​"''​pihole -a -p''"​. ​+**Step 5:** To change the password we need to access the router ​with command line interface. Log in via ssh, telnet or serial connection and then run the command "''​lxc-attach guest0''"" ​to enter the shell in LXC, then run the command "''​pihole -a -p''" ​for changing the password
  
-**The installation is finished and Pi-hole is now in working condition.** You can access the webgui (192.168.1.111) any time and view the dashboard or login to adjust settings.+{{:​virtualisation:​05-pihole-gui.png}}
  
 +**The installation is finished and Pi-hole is now in working condition.** You can access the webgui on ''​192.168.1.111''​ any time and view the dashboard or login to adjust settings.
  
  
-====== Advanced Installagion Guide ====== ​ 
  
-This is an optional alternative to Step 3 of the "Basic Install Setup Virtualization Guide"​. Here we describe the steps necessary to install Pi-hole from scratch. 
  
-===== Get latest debian image (only necessary for manual install) ===== 
  
- 
-To get the latest debian armhf rootfs file please visit https://​uk.lxd.images.canonical.com/​images/​debian/​stretch/​armhf/​default/​. Choose the most recent date and then right click the rootfs.tar.xz file (should be around 56MB size) and pick "copy link". On the router we navigate to the Install tab and paste the link, also check the Install on "​Apply"​ checkbox then hit the Apply button. This should take around 2 minutes. keep in mind that the other steps of the regular guide are still necessary. 
- 
-{{:​virtualisation:​03-1-pihole-debian.png}} 
-{{:​virtualisation:​03-2-pihole-debian.png}} 
-{{:​virtualisation:​03-3-pihole-debian.png}} 
  
                                                                                                     ​                                                                                                     ​
-===== Install Pi-hole manually ===== 
-                                                                                                    ​ 
-Please login on the NetModule router via SSH, Telnet or Serial connection. The virtualization should now already be running, you can check the status with the command "''​lxc-info guest0''"​. 
  
-{{:​virtualisation:​01-pihole-lxc-info.png}} 
-                                                                                                    ​ 
-**Step 1:** In the bash we will now attach to the linux container with the command "''​lxc-attach guest0''"​. We should see "''​root@LXC_NAME:​~#''"​ prompt, this means we successfully attached. 
- 
-{{:​virtualisation:​02-pihole-lxc-attach.png}} 
-                                                                                                    ​ 
-**Step 2:** To install curl we run the command "''​apt install curl''"​. ​   
- 
-{{:​virtualisation:​03-pihole-apt-install-curl.png}} 
-                                                                                                    ​ 
-**Step 3:** Next we Run the command "''​curl -sSL https://​install.pi-hole.net -k | bash''",​ the installations progress should start right away. 
- 
-{{:​virtualisation:​04-pihole-install-pihole.png}} 
-                                                                                                    ​ 
-**Step 4:** The installation will ask you a couple of questions, you can answer them all with yes or pick the default value. The installation will take approximately 15 minutes, this is the right time to get a fresh cup of coffee or tea. 
- 
-{{:​virtualisation:​05-pihole-install-yes.png}} 
-                                                                                                    ​ 
-**Step 5:** When you come back you should now see the "​Installation Complete!"​ screen. You can write down your Admin Webpage login password seen at the bottom or change it later with the command "''​pihole -a -p''"​. 
- 
-{{:​virtualisation:​06-pihole-password.png}} 
-                                                                                                    ​