This is an updated fork of Gravity Sync, modified to support Pi-hole v6.x. The original project by vmstan was retired in July 2024. This version (6.4.1) restores compatibility with the Pi-hole v6 architecture.
What is better than a Pi-hole blocking trackers, advertisements, and other malicious domains on your network? That's right, two Pi-hole blocking all that junk on your network!
But if you have redundant Pi-hole in your network you'll want a simple way to keep the list configurations and local DNS settings identical between the two. That's where Gravity Sync comes in. Setup should only take a few minutes.
pihole-FTL sqlreplaced withpihole-FTL sqlite3 -nipihole restartdnsreplaced withpihole reloaddns/pihole reloadlists- Custom DNS records path updated to
hosts/custom.list - CNAME and static DHCP sync now uses the FTL config API (
pihole-FTL --config) instead of dnsmasq config files, which were removed in v6 - Full TOML config sync — 30+ configurable keys (DNS settings, blocking, cache, DHCP, resolver, database)
- Automatic Pi-hole v6 detection — falls back to legacy dnsmasq file sync if v6 is not detected
Gravity Sync replicates the core of Pi-hole's ad/telemetry blocking settings, which includes:
- Adlist settings with status and comments.
- Domain/RegEx whitelists and blacklist along with status and comments.
- Clients and group assignments, along with status and descriptions.
Gravity Sync also replicates local network DNS/DHCP settings, which includes:
- Local DNS Records.
- Local CNAME Records (via FTL config API on v6).
- Static DHCP Assignments (via FTL config API on v6).
- All configurable pihole.toml keys (see
PH_V6_TOML_SYNC_KEYSin ENV.md).
Gravity Sync will not:
- Modify or sync the individual Pi-hole's upstream DNS resolvers.
- Merge query logs, statistics, long-term data, caches, or other resolution information.
- Sync individual Pi-hole DHCP scoping information or leases.
- Pi-hole v6.x on both primary and secondary instances
- SSH key-based authentication between the two hosts
rsyncinstalled on both hostsinotify-tools(optional, for event-based auto-sync)
- Copy
gravity-syncto/usr/local/bin/gravity-syncon the primary Pi-hole - Create config:
sudo mkdir -p /etc/gravity-sync && sudo nano /etc/gravity-sync/gravity-sync.conf - Set
REMOTE_HOSTandREMOTE_USERin the config - Set
GS_SSH_PKIFto your SSH private key path - Test:
sudo gravity-sync compare - Sync:
sudo gravity-sync push
Reacts instantly when Pi-hole config changes, zero CPU overhead while idle.
sudo apt install inotify-tools -y
sudo cp templates/gravity-sync-watch.sh /usr/local/bin/
sudo chmod +x /usr/local/bin/gravity-sync-watch.sh
sudo cp templates/gravity-sync-watch.service /etc/systemd/system/
sudo systemctl enable --now gravity-sync-watch.servicesudo cp templates/gravity-sync.service /etc/systemd/system/
sudo cp templates/gravity-sync.timer /etc/systemd/system/
sudo systemctl enable --now gravity-sync.timerdocker build -t gravity-sync .
docker run -v /path/to/gravity-sync.conf:/etc/gravity-sync/gravity-sync.conf \
-v /path/to/ssh-key:/root/.ssh/id_ed25519:ro \
gravity-sync pushA standalone Python tool that merges query logs from both Pi-hole instances into a single filterable web view. No external dependencies required.
cp viewer-config.example.json viewer-config.json
# Edit viewer-config.json with your Pi-hole URLs and passwords
python3 pihole-query-viewer.py
# Open http://localhost:8088Filters: domain search, allowed/blocked status, primary/secondary source, DNS type, upstream server.
Gravity Sync is not developed by or affiliated with the Pi-hole project. This is an unofficial, community effort, that seeks to implement replication (which is currently not a part of the core Pi-hole product) in a way that provides stability and value to Pi-hole users. The code has been tested across multiple user environments but there always is an element of risk involved with running any arbitrary software you find on the Internet.
Pi-hole is and the Pi-hole logo are registered trademarks of Pi-hole LLC.