Thema configurator

  • Momenteel werken we aan deze website en het vullen van content.
Pi-hole v6 op UGREEN NAS met Unbound & Nebula Sync | Complete Master/Slave Setup

Pi-hole v6 op UGREEN NAS met Unbound & Nebula Sync | Complete Master/Slave Setup

Pi-hole v6 op UGREEN NAS met Unbound & Nebula Sync | Complete Master/Slave Setup​

Blokkeer advertenties netwerk-breed, resolv DNS recursief zonder externe providers en synchroniseer automatisch met een tweede Pi-hole instantie volledig in Docker op je UGREEN NAS.

Introductie​

In deze handleiding zet je een volledige Pi-hole stack op een UGREEN NAS (DXP6800 Pro in mijn geval) als slave naast een bestaande Pi-hole op bijvoorbeeld Proxmox als master. De stack bestaat uit drie services:
  • Unbound — recursieve DNS resolver, geen afhankelijkheid van 1.1.1.1 of 8.8.8.8
  • Pi-hole v6 — DNS sinkhole, blokkeert advertenties en tracking netwerk-breed
  • Nebula Sync — synchroniseert adlists en domeinen automatisch van master naar slave
Het resultaat: twee Pi-hole instanties die altijd in sync zijn. Als de Proxmox server uitvalt, neemt de NAS het DNS-verkeer naadloos over.

Vereisten​

  • UGREEN NAS met Docker ondersteuning
  • Bestaande Pi-hole v6 op een andere host (master), in dit geval 192.168.1.11
  • SSH toegang tot de NAS
  • Vaste IP van de NAS, in dit geval 192.168.1.20

Stap 1 — Mapstructuur aanmaken​

Code:
mkdir -p /volume1/docker/pihole/pihole
mkdir -p /volume1/docker/pihole/dnsmasq.d
mkdir -p /volume1/docker/pihole/unbound

Stap 2 — Unbound config bestanden aanmaken​

Unbound verwacht drie bestanden die standaard niet bestaan:
Code:
touch /volume1/docker/pihole/unbound/a-records.conf
touch /volume1/docker/pihole/unbound/srv-records.conf
touch /volume1/docker/pihole/unbound/forward-records.conf

Stap 3 — Docker Compose aanmaken​

Maak het bestand /volume1/docker/pihole/docker-compose.yaml aan met de volgende inhoud:
Code:
########################### NETWORKS
# Intern bridge netwerk voor Pi-hole stack
# Subnet: 172.22.0.0/24
# - 172.22.0.2 = Unbound (recursieve DNS resolver)
# - 172.22.0.3 = Pi-hole (ad blocker / DNS slave)
networks:
  pihole_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.22.0.0/24

########################### SERVICES
services:

  # -------------------------------------------------------
  # UNBOUND - Recursieve DNS resolver
  # Vervangt externe DNS providers (1.1.1.1 / 8.8.8.8)
  # Draait op 172.22.0.2:53
  # -------------------------------------------------------
  unbound:
    image: mvance/unbound:latest
    container_name: unbound
    hostname: unbound
    networks:
      pihole_net:
        ipv4_address: 172.22.0.2
    restart: unless-stopped
    volumes:
      - /volume1/docker/pihole/unbound:/opt/unbound/etc/unbound:rw

  # -------------------------------------------------------
  # PI-HOLE - DNS sinkhole / ad blocker (SLAVE)
  # Master: 192.168.1.11 (Proxmox)
  # Slave:  192.168.1.20 (UGREEN NAS)
  # Webinterface: http://192.168.1.20:8082/admin
  # DNS luistert op: 192.168.1.20:53
  # -------------------------------------------------------
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    hostname: pihole-slave
    depends_on:
      - unbound
    networks:
      pihole_net:
        ipv4_address: 172.22.0.3
    ports:
      - "192.168.1.20:53:53/tcp"
      - "192.168.1.20:53:53/udp"
      - "8082:8080/tcp"
    security_opt:
      - no-new-privileges=true
    restart: unless-stopped
    volumes:
      - /volume1/docker/pihole/dnsmasq.d:/etc/dnsmasq.d:rw
      - /volume1/docker/pihole/pihole:/etc/pihole:rw
    environment:
      FTLCONF_webserver_api_password: "jouwwachtwoord"
      FTLCONF_webserver_port: 8080
      FTLCONF_dns_listeningMode: all
      FTLCONF_dns_upstreams: "172.22.0.2#53"   # Unbound als upstream
      FTLCONF_dhcp_active: "false"              # DHCP uitgeschakeld
      TZ: Europe/Amsterdam
      DNSMASQ_USER: pihole
    cap_add:
      - SYS_TIME
      - SYS_NICE
      - NET_ADMIN

  # -------------------------------------------------------
  # NEBULA SYNC - Synchronisatie van master naar slave
  # Synct elke 5 minuten: adlists, domeinen, groepen
  # Master: http://192.168.1.11 (Proxmox Pi-hole)
  # Slave:  http://172.22.0.3:8080 (NAS Pi-hole)
  # SYNC_CONFIG_DNS=false zodat Unbound upstream NIET
  # overschreven wordt door de master zijn DNS instellingen
  # -------------------------------------------------------
  nebula-sync:
    image: lovelaze/nebula-sync:latest
    container_name: nebula-sync
    networks:
      - pihole_net
    restart: unless-stopped
    depends_on:
      - pihole
    environment:
      PRIMARY: "http://192.168.1.11|jouwwachtwoord"
      REPLICAS: "http://172.22.0.3:8080|jouwwachtwoord"
      FULL_SYNC: "false"
      RUN_GRAVITY: "true"
      CRON: "*/5 * * * *"
      TZ: Europe/Amsterdam
      # Config sync uitgeschakeld - voorkomt overschrijven van Unbound upstream
      SYNC_CONFIG_DNS: "false"
      SYNC_CONFIG_DHCP: "false"
      SYNC_CONFIG_NTP: "false"
      SYNC_CONFIG_RESOLVER: "false"
      SYNC_CONFIG_MISC: "false"
      # Gravity sync - adlists, domeinen en groepen
      SYNC_GRAVITY_AD_LIST: "true"
      SYNC_GRAVITY_AD_LIST_BY_GROUP: "true"
      SYNC_GRAVITY_DOMAIN_LIST: "true"
      SYNC_GRAVITY_DOMAIN_LIST_BY_GROUP: "true"
      SYNC_GRAVITY_GROUP: "true"
      SYNC_GRAVITY_CLIENT: "false"
Let op: Vervang 192.168.1.11, 192.168.1.20 en jouwwachtwoord met je eigen waarden. Controleer ook of subnet 172.22.0.0/24 vrij is met:
Code:
docker network ls -q | xargs docker network inspect --format '{{.Name}}: {{range .IPAM.Config}}{{.Subnet}}{{end}}'

Stap 4 — Stack opstarten​

Code:
cd /volume1/docker/pihole
docker compose up -d

Stap 5 — Testen​

DNS via Unbound:
Code:
docker exec pihole nslookup google.com 172.22.0.2
DNS via Pi-hole:
Code:
nslookup google.com 192.168.1.20
Nebula Sync logs:
Code:
docker logs nebula-sync --tail 20
Je zou dit moeten zien:
Code:
INF Running sync mode=selective replicas=1
INF Authenticating clients...
INF Syncing teleporters...
INF Syncing configs...
INF Running gravity...
INF Invalidating sessions...
INF Sync completed
Adlists controleren:
Code:
docker exec pihole pihole-FTL sqlite3 /etc/pihole/gravity.db "SELECT address, enabled FROM adlist;"

Stap 6 — Router instellen​

Stel je router in om beide Pi-hole instanties als DNS te gebruiken:
  • Primaire DNS: 192.168.1.11 (Proxmox — master)
  • Secundaire DNS: 192.168.1.20 (UGREEN NAS — slave)
Alle apparaten in je netwerk gaan nu automatisch via Pi-hole. Bij uitval van de master neemt de slave het over.

Aanbevolen Adlists​

Voeg deze lijsten toe op de master Pi-hole (http://192.168.1.11/admin) — ze worden automatisch gesynchroniseerd naar de slave.
NaamURL
OISD Bighttps://big.oisd.nl
HaGeZi Multi Prohttps://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/pro.txt
StevenBlack Unifiedhttps://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
HaGeZi Threat Intelligencehttps://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/tif.txt
URLhaushttps://urlhaus-filter.pages.dev/urlhaus-filter-hosts.txt

Bekende valkuilen​

macvlan werkt niet op UGREEN NAS De UGREEN NAS gebruikt een Linux bridge (bridge0) waar macvlan niet op werkt. Gebruik daarom een gewone bridge met port mapping zoals in deze handleiding.
Orbital Sync werkt niet met Pi-hole v6 Orbital Sync is gearchiveerd en ondersteunt Pi-hole v6 niet. Gebruik Nebula Sync als vervanging.
FULL_SYNC=true geeft een 400 fout Dit komt doordat de master zijn DNS upstream (1.1.1.1) de Unbound upstream op de slave (172.22.0.2) overschrijft. Gebruik FULL_SYNC=false met expliciete SYNC_GRAVITY_* opties zoals in deze handleiding.

Webinterface​

Na het opstarten is de Pi-hole webinterface bereikbaar op:
Code:
http://192.168.1.20:8082/admin
1778159065765.webp


Getest op UGREEN DXP6800 Pro met Pi-hole v6.4.2, Unbound en Nebula Sync v0.11.2
Terug
Naar boven