Pi-hole IPv6 Setup: Reliably Distinguish Certain Clients/Groups
In this article, we will discuss setting up Pi-hole with IPv6 and reliably distinguishing certain clients or groups for bypassing blocklists. Pi-hole is a popular network-wide ad blocker that works by acting as a DNS sinkhole and blocking queries to known ad-serving domains. With the increasing adoption of IPv6, it is crucial to ensure that Pi-hole can handle both IPv4 and IPv6 addresses.
Prerequisites
Before we begin, ensure that you have the following:
- A working Raspberry Pi setup with Pi-hole installed.
- A local home network with IPv4 and IPv6 support.
- A list of clients or groups that you want to bypass the blocklist.
Configuring Pi-hole for IPv6
To configure Pi-hole for IPv6, follow these steps:
- Log in to your Raspberry Pi and open the Pi-hole web interface.
- Navigate to the
Settingspage and click onDNS. - Scroll down to the
IPv6section and ensure that theListen on IPv6option is enabled. - Save your changes and restart the Pi-hole service.
sudo systemctl restart pi-hole
Creating Custom Query Classes
To reliably distinguish certain clients or groups, we can create custom query classes. A query class is a way to group clients based on their IP addresses. By default, Pi-hole has two query classes: default and pihole-ftl. We will create a new query class for our clients or groups.
- Create a new file called
/etc/pihole/query_class.confwith the following contents:
# Custom query classes
mygroup::192.168.0.0/24
mygroup::2001:db8::/64
Replace mygroup with a name of your choice, and replace the IPv4 and IPv6 addresses with the addresses of your clients or groups. The double colon (::) is used to specify IPv6 addresses.
- Restart the Pi-hole service to apply the changes:
sudo systemctl restart pi-hole
Configuring Group-Specific Blocklists
Now that we have created a custom query class, we can configure group-specific blocklists. To do this, follow these steps:
- Navigate to the
Group Managementpage in the Pi-hole web interface. - Create a new group and assign the custom query class that you created earlier.
- Configure the blocklists for the group. You can choose to use the default blocklists or add your own.
- Save your changes and restart the Pi-hole service.
sudo systemctl restart pi-hole
In this article, we have discussed setting up Pi-hole with IPv6 and reliably distinguishing certain clients or groups for bypassing blocklists. We have covered the following topics:
- Configuring Pi-hole for IPv6
- Creating custom query classes
- Configuring group-specific blocklists