High-Availability Pi-hole Synchronization & Docker Networking
Last Updated: March 2026 | Target Hardware: Micro PC Cluster (Intel i5 7th-gen)
Overview: This article documents the validated procedure for deploying a high-availability DNS sinkhole architecture using two micro PCs running CasaOS. [cite: 1, 3, 7] By leveraging Gravity Sync, the Secondary Pi-hole (192.168.0.152)x.x) mirrors the DNS payload of the Primary Pi-hole (192.168.0.160)x.x). [cite: 8]
Prerequisites
- Primary Server (LinuxServer): 192.168.
0.160 [cite: 11]x.x - Secondary Server (LinuxServer2): 192.168.
0.152 [cite: 12]x.x - Pi-hole installed via Docker (CasaOS) on both nodes.
[cite: 13] - Active SSH credentials for both servers.
[cite: 14]
Step 1: Install Gravity Sync on Both Servers
The synchronization tool must be installed on the host OS of both micro PCs. [cite: 16] To bypass retired domain links, execute the following command on both nodes: [cite: 17]
curl -sSL https://raw.githubusercontent.com/vmstan/gs-install/main/gs-install.sh | bash
Step 2: Configure the Secondary Node
Because the Secondary Server "pulls" data from the Primary, execute the configuration wizard from LinuxServer2 (192.168.0.152): [cite: 21]
- Initiate Wizard: Run
gravity-sync config.[cite: 22] - Define Remote Host: Enter the IP of the Primary Server (192.168.
0.160). [cite: 23]x.x - Authenticate: Enter the Primary Server's SSH username and password to register RSA keys.
[cite: 24, 25] - Define Container Names: Manually confirm the container names
aspiholefor both Local and Remote prompts.[cite: 26, 27, 28]
Step 3: Perform Initial Manual Sync
On the Secondary Server (192.168.0.152)x.x), run the following to establish the baseline mirror: [cite: 30, 31]
gravity-sync pull
Step 4: Automate the Synchronization
To ensure future changes to blocklists or local DNS are synced automatically, enable the background service on the Secondary Server: [cite: 34, 35]
gravity-sync auto
Note: This registers a systemd timer that compares database hashes every 5 minutes with zero noticeable overhead on NVMe drives. [cite: 38, 39]
Step 5: Resolve Docker Network Restrictions (Pi-hole v6 Fix)
By default, CasaOS Docker deployments may cause Pi-hole to drop incoming LAN requests. [cite: 42] You must manually configure the secondary node to trust LAN traffic: [cite: 43].
- Log into the Secondary Web UI:
http://192.168.0.152:x.x:81/admin[cite: 44] - Navigate to Settings >
DNSDNS.. [cite: 45] - Toggle the top-right corner from Basic to Advanced.
[cite: 46] - In Interface settings, select Permit all origins.
[cite: 47, 48] - Click Save & Apply.
[cite: 49]
Step 6: Validate Failover
Perform a direct query test from a Windows client on the same network: [cite: 51]
nslookup google.com 192.168.0.152x.x
Expected Result: The terminal should return a list of IP addresses. [cite: 54] If it returns "Timeout," re-verify the settings in Step 5. [cite: 55]