Last active 2 weeks ago

Das ist die Zusammenfassung, für einen Hetzner VPS mit Adguard Home und Unbound

Revision 47b0d86ef9b70b63f95673d13a4aeefbc4460ce4

walkthrough.md Raw

AdGuard Home + Wireguard + UDM pro

Nach einer Anleitung von TheMorpheus https://www.youtube.com/watch?v=0cBZR4wy3ec https://www.patreon.com/posts/157177525

Server config

  • CX 23
  • 2 VCPU
  • 4 GB RAM
  • Ubuntu 24.04

Walkthrough

apt update && apt install -y ufw
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp   comment "SSH"
ufw allow 80/tcp   comment "HTTP-01 ACME (Cert-Erneuerung)"
ufw allow 443/tcp  comment "DoH"
ufw --force enable
ufw status verbose
apt install -y unbound dns-root-data
nano /etc/unbound/unbound.conf.d/custom.conf
server:
  # Nur auf Loopback lauschen, auf einem nicht-Standard-Port (NICHT 5353 — das ist mDNS).
  interface: 127.0.0.1
  port: 5335
  do-ip4: yes
  do-ip6: no            # nur auf yes, wenn dein VPS funktionierendes IPv6 hat, dann echt geil, kann nochmal deutlich schneller sein
  do-udp: yes
  do-tcp: yes
  # Nur Anfragen von localhost akzeptieren
  access-control: 127.0.0.0/8 allow
  access-control: 0.0.0.0/0 refuse
  access-control: ::0/0 refuse
  hide-identity: yes
  hide-version: yes
  # Hardening
  harden-glue: yes
  harden-dnssec-stripped: yes
  harden-below-nxdomain: yes
  harden-referral-path: yes
  qname-minimisation: yes
  use-caps-for-id: no   # yes für 0x20-Randomisierung; bricht ein paar Sites
  # Der DNSSEC-Trust-Anchor wird vom Default-Snippet des Pakets gesetzt,
  # auto-trust-anchor-file hier NICHT erneut deklarieren.
  # Schutz gegen DNS-Rebinding / Antworten mit privaten Adressen.
  # Für eigene interne Zonen zusätzlich local-zone / private-domain konfigurieren.
  private-address: 10.0.0.0/8
  private-address: 172.16.0.0/12
  private-address: 192.168.0.0/16
  private-address: 169.254.0.0/16
  private-address: fd00::/8
  private-address: fe80::/10
  # Cache (auf VPS-RAM anpassen; das hier ist konservativ für ~1 GB)
  msg-cache-size: 64m
  rrset-cache-size: 128m
  msg-cache-slabs: 4
  rrset-cache-slabs: 4
  infra-cache-slabs: 4
  key-cache-slabs: 4
  # Performance
  prefetch: yes
  prefetch-key: yes
  num-threads: 2        # an deine vCPU-Anzahl anpassen
  so-rcvbuf: 1m
  unwanted-reply-threshold: 10000000
  edns-buffer-size: 1232  # vermeidet Fragmentierung auf den meisten Pfaden
remote-control:
  # Aktiviert "unbound-control" (für Stats und Live-Befehle, später nützlich)
  control-enable: yes
  control-interface: 127.0.0.1
unbound-control-setup
unbound-checkconf
systemctl restart unbound
systemctl enable unbound
systemctl status systemd-resolved --no-pager
resolvectl status 2>/dev/null | head -5
ss -tulpen | grep ':53'
mkdir -p /etc/systemd/resolved.conf.d
cat > /etc/systemd/resolved.conf.d/disable-stub.conf <<EOF
[Resolve]
DNSStubListener=no
EOF
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
systemctl restart systemd-resolved