Automatic Split DNS with PiHole
Using Blocky in conjunction with PiHole enables seamless automated split DNS functionality.
Install Blocky
-
Install Blocky from the premium train with all defaults except for the following.
-
Override Default Upstreams
a. Here you can choose your upstream DNS servers of choice. In my example I am using Google.
-
Enable k8s-Gateway
a. Here you need to add your domain for split DNS.
-
DNS TCP/UDP Port Configurations
a. Since PiHole will be using port 53 for DNS we need to change the port on blocky to something else. The recommend port is 5335. If you are using MetalLB then this step is not needed.
Install PiHole
-
Install PiHole from the Stable train with all the defaults except for the following.
-
Web Password
a. Here you need to pick a password for the PiHole WebGUI.
-
DNS Servers
a. Here you need to remove one of the pre-configured entries and change the other to your Blocky DNS address. In my example the address is my TrueNAS Scale server IP and the port we previously configured for Blocky. If you are using MetalLB this would just need to be the IP address assigned to Blocky.
Configure Router
- Configure your router to use your PiHole DNS when configuring DNS clients. You will need to consult your router manual for this as each router is different. In my example I would configure my router to use 192.168.1.2 as the DNS server. If you use MetalLB this would be the IP address assigned to PiHole.