JustToThePoint English Website Version
JustToThePoint en español
Colaborate with us

Deployint Pi-hole in Proxmox.

To err is human, to blame it on someone else is even more human, Jacob’s Law

Pi-hole

Introduction

The Pi-hole® is an easy-to-install, lightweight, and open-source DNS sinkhole that protects your devices from unwanted content, without installing any client-side software.

A sinkhole in Pi-hole is essentially a DNS resolution technique that redirects requests for known ad-serving domains to a non-routable IP address (typically 0.0.0.0 or 127.0.0.1). This means that when a device on your network attempts to reach an ad domain, it is redirected to a “black hole,” effectively preventing the ad from being served.

Installation

We are going to install it using Proxmox VE Helper-Scripts. These are a collection of scripts for simplifying and optimizing your HomeLab.

In the section of Ad Blocker -DNS, select Pi-Hole LXC. AdBuard Home LXC is another widely-used Ad blocker.

To create a new Proxmox VE Pi-hole LXC, run the command below in the Proxmox VE Shell.

bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/pihole.sh)"

Step 1. This will create a New Pihole LXC. Proceed? Yes Step 2. User Default Setting? Yes Step 3. Which storage pool you would like to use for the container? mypool (Adjust to your settings.) Step 4. Would you like to add Unbound? Yes

LX Container 103 was successfully created. […] Network Connected: 192.168.1.126. […]

# After installing Pi-hole for the first time, a password is generated and displayed to the user. The password cannot be retrieved later on, but it is possible to set a new password:
# Go to your docker, e.g., 103 (pihole) (root, password empty) and create a new password.
sudo pihole -a -p

Step 5. Go to [http://] + Network Connected + [/admin], e.g., [http://] + 192.168.1.126 + [/admin]

Step 6. Add a new adlist. Go to Adlist, type a list in Address (e.g., Blocklistproject, https://raw.githubusercontent.com/blocklistproject/Lists/refs/heads/master/ads.txt), a description in Comments (e.g., adds), and smash the Add button. Then, run pihole -g or update your gravity list online after modifying your adlists.

Router and client configuration

The rooter configuration depends on your models and ISP provider. Open a web browser, type your router's IP address in the address bar (e.g., 192.168.0.1, 192.168.1.1, 10.0.0.1, 172.16.0.1).

You’ll be prompted for a username and password. These are usually printed on a sticker on the router itself or in the manual.

Locate the DNS Settings. Look for a section labeled “Basic,” “Internet,” “WAN,” “LAN,” “DHCP,” or “DNS.” Within that section, you should find fields for “DNS Server,” “Primary DNS,” “Secondary DNS,” or similar. Then, change the DNS Servers.

The best approach is usually to configure your router’s DHCP server to provide the Pi-hole’s IP address as the DNS server. This way, all devices that connect to your network via DHCP will automatically use the Pi-hole.

Look for “DHCP Server” settings (e.g., Menu, Configuración Avanzada, Advanced Setup, DNS, DNS Server). Change the “Primary DNS Server” to your Pi-hole’s IP address. Leave the “Secondary DNS Server” blank or set it to the “Primary DNS Server” (e.g., 9.9.9.9) a public DNS server like Google’s (8.8.8.8) or Cloudflare’s (1.1.1.1) as a backup in case your Pi-hole is unavailable.

Click “Save,” “Apply,” or a similar button to save your changes. Your router might reboot.

Pi-hole Router

If you can't or don't want to change your router's DNS settings, you can configure individual clients (computers, smartphones, tablets, etc.) to use your Pi-hole as their DNS server.

  1. Windows. Open Control Panel and go to Network and Internet, Network and Sharing Center, Change adapter settings. Right-click on the network adapter you’re using (Wi-Fi or Ethernet) and select Properties. Internet Protocol Version 4 (TCP/IPv4): Select “Internet Protocol Version 4 (TCP/IPv4)” and click “Properties.” Use the following DNS server addresses: Select this option. Preferred DNS server: Enter your Pi-hole’s IP address.

  2. macOS: System Preferences, Network. Select the network you’re using (Wi-Fi or Ethernet) and click Advanced. Go to the “DNS” tab. Add DNS Server: Click the “+” button to add a new DNS server. Enter your Pi-hole’s IP address. Click “OK” and “Apply” to save the changes.

  3. Linux. It varies depending on the desktop environment and network manager you’re using, e.g., open your network settings, select the network connection you’re using, look for IPv4 Settings or similar. Change the Method to Manual and enter your Pi-hole’s IP address in the “DNS” field.

image info

Configuring your Pi-hole to assign names to your clients

One way to ensure that clients always get the same IP address and hostname is using Pi-Hole as a DHCP server. Go to Settings, DHCP, and enable DHCP Server.

If your router is handling DHCP, you’ll need to disable DHCP on your router and let Pi-hole handle it.

Local DNS Records. If you don’t want to use DHCP or if you have devices with static IP addresses that you want to give names, you can use local DNS records.

In the Pi-hole web interface, go to Settings, Local DNS Records, Add Record. There are two fields:

Even though you’ve added the local DNS record in Pi-hole, your devices might not be querying Pi-hole for DNS or they might have cached old DNS records.

  1. Verify Pi-hole is the DHCP Server.
  2. Check Client DNS Settings (If Not Using Pi-hole DHCP).
  3. Flush DNS Cache on Clients: ipconfig /flushdns (Windows), sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder (macOS), sudo systemd-resolve --flush-caches or sudo /etc/init.d/nscd restart or sudo service networking restart (Linux).

In NixOS, open your /etc/nixos/configuration.nix file:

nameservers = [ "192.168.1.126" "80.58.61.254"]; # where "192.168.1.126" is Pi-Hole's IP Address

# Rebuild your NixOS configuration and switch to the new configuration:
sudo nixos-rebuild switch
Bitcoin donation

JustToThePoint Copyright © 2011 - 2025 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.