network:pihole_npm
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| network:pihole_npm [2026/01/26 15:11] – created nathna | network:pihole_npm [2026/01/26 15:15] (current) – nathna | ||
|---|---|---|---|
| Line 44: | Line 44: | ||
| ==== Pi-hole1 (/ | ==== Pi-hole1 (/ | ||
| + | vrrp_instance VI_1 { | ||
| + | state MASTER | ||
| + | interface eth0 | ||
| + | virtual_router_id 51 | ||
| + | priority 200 | ||
| + | advert_int 1 | ||
| + | authentication { | ||
| + | auth_type PASS | ||
| + | auth_pass torresvault | ||
| + | } | ||
| + | virtual_ipaddress { | ||
| + | 192.168.1.5/ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | ==== Pi-hole2 (/ | ||
| + | |||
| + | |||
| + | |||
| + | vrrp_instance VI_1 { | ||
| + | state BACKUP | ||
| + | interface eth0 | ||
| + | virtual_router_id 51 | ||
| + | priority 100 | ||
| + | advert_int 1 | ||
| + | authentication { | ||
| + | auth_type PASS | ||
| + | auth_pass torresvault | ||
| + | } | ||
| + | virtual_ipaddress { | ||
| + | 192.168.1.5/ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | Keepalived automatically transfers 192.168.1.5 to the healthy node. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Orbital-Sync (Pi-hole Sync) ===== | ||
| + | |||
| + | Orbital-Sync keeps: | ||
| + | |||
| + | * Adlists | ||
| + | * Whitelists | ||
| + | * Blacklists | ||
| + | * Regex filters | ||
| + | * DHCP settings | ||
| + | * Groups | ||
| + | * Clients | ||
| + | |||
| + | …identical on both Pi-holes. | ||
| + | |||
| + | ==== Docker Compose ==== | ||
| + | Located at `/ | ||
| + | |||
| + | |||
| + | |||
| + | version: " | ||
| + | services: | ||
| + | orbital-sync: | ||
| + | image: mattwebbio/ | ||
| + | container_name: | ||
| + | volumes: | ||
| + | - ./ | ||
| + | restart: unless-stopped | ||
| + | |||
| + | |||
| + | ==== Config File (config.yml) ==== | ||
| + | |||
| + | |||
| + | |||
| + | primaryHost: | ||
| + | baseUrl: http:// | ||
| + | |||
| + | |||
| + | secondaryHosts: | ||
| + | |||
| + | baseUrl: http:// | ||
| + | |||
| + | |||
| + | sync: | ||
| + | intervalMinutes: | ||
| + | adlists: true | ||
| + | whitelist: true | ||
| + | blacklist: true | ||
| + | regexWhitelist: | ||
| + | regexBlacklist: | ||
| + | groups: true | ||
| + | clients: true | ||
| + | localDns: true | ||
| + | cname: true | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sync Interval ===== | ||
| + | |||
| + | Orbital-sync runs automatically: | ||
| + | |||
| + | * **Every 15 minutes** | ||
| + | * Sync direction: **192.168.1.2 → 192.168.1.4** | ||
| + | |||
| + | It detects changes on either Pi-hole and ensures both match. | ||
| + | |||
| + | ==== Manual Sync Command ==== | ||
| + | |||
| + | |||
| + | |||
| + | docker exec orbital-sync npm run sync | ||
| + | |||
| + | |||
| + | OR restart the container: | ||
| + | |||
| + | |||
| + | |||
| + | docker restart orbital-sync | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Failover Behavior ===== | ||
| + | |||
| + | ==== Example Scenario ==== | ||
| + | * Pi-hole1 goes offline | ||
| + | * Keepalived detects failure | ||
| + | * Pi-hole2 takes VIP 192.168.1.5 | ||
| + | * Clients never notice — all DNS continues normally | ||
| + | * When Pi-hole1 recovers, it becomes BACKUP | ||
| + | |||
| + | Failover time: typically **1–2 seconds**. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== How to Test HA ===== | ||
| + | |||
| + | 1. Open a terminal on Pi-hole1 | ||
| + | 2. Run: | ||
| + | |||
| + | |||
| + | |||
| + | sudo systemctl stop keepalived | ||
| + | |||
| + | |||
| + | 3. The VIP should instantly move: | ||
| + | * Pi-hole2 now shows: `hostname: PiHole2` | ||
| + | * And `ip addr` confirms `192.168.1.5` | ||
| + | 4. Restart keepalived: | ||
| + | |||
| + | |||
| + | |||
| + | sudo systemctl start keepalived | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | |||
| + | Common issues: | ||
| + | |||
| + | * VIP not moving → check keepalived config | ||
| + | * Orbital-sync errors → config.yml path or permissions | ||
| + | * Docker needing `sudo` → add user to docker group | ||
| + | * Regex rules not syncing → ensure regex sync is enabled | ||
| + | * Pi-hole showing uneven stats → normal; traffic is not load-balanced, | ||
| + | |||
| + | ---- | ||
network/pihole_npm.1769458278.txt.gz · Last modified: by nathna
