this guide is currenly a WIP as this script doesnt seem to work yet. I've raised the issue here: https://github.com/vmstan/gravity-sync/issues/119

reference: https://github.com/vmstan/gravity-sync

see this wiki's pi-hole guide if you have not already

optional, but recommended, also refer to this wiki's unbound guide

I used to run one pi-hole dns server in high availability. This meant that if the VM ever failed, or the physical server hosting the VM went down, the VM would automatically replicate over to another physical host and continue to run.

this did not however give me a secondary dns server. some devices just really want 2 IPs for dns. you also may just want true redundancy with 2 dns servers. you may want to play around with syncing 2 servers. you may just want to do this because, or all of the above. this is where I am now. the above script achieves this with two pi-hole instances, syncing the block lists, dns entries, and other settings between the two.

login to your primary pi-hole then (do NOT run with sudo):

export GS_INSTALL=primary && curl -sSL https://gravity.vmstan.com | bash

run this for pi-hole 2 (note the subtle difference):

export GS_INSTALL=secondary && curl -sSL https://gravity.vmstan.com | bash

if you run into any red x's (failures) you will need to resolve them and re-run the script. in my case, because I typically utilize debian for my VMs, rsync was not installed. (easily remedied with apt-get install rsync).

once the secondary script is run, it will run through the overall config

-skip the advanced config, all the defaults are good
-input your primary dns ip
-input ssh user, answer yes to ssh key, and enter pw

test the sync, cd to gravity-sync directory then:

./gravity-sync.sh compare

it should detect a difference in lists and note replication required. now run the actual sync script to sync

./gravity-sync.sh

if it fails and complains about sudo, tty, askpass, etc, you did a baddie and used sudo during install. hopefully, you took a snapshot of your VM

if not, great. now set up your automation.

./gravity-sync.sh automate

choose how many minutes your servers will wait to sync, then the hour of day they will backup. next verify the cron job:

./gravity-sync.sh cron smart
crontab -l

you should see your cron job for gravity sync. also check the script it is referencing. if it is missing, try running the smart command again.

Discussion

Enter your comment. Wiki syntax is allowed:
 
Last modified: le 2020/12/10 01:35