de:server:services:unbound

Unbound

Unbound ist ein validierendes, rekursives und zwischenspeicherndes DNS-Resolver-Produkt von NLnet Labs. Es wird kostenlos in Open-Source-Form unter der BSD-Lizenz vertrieben.

sudo pacman -S unbound expat
sudo nano /etc/unbound/unbound.conf
server:
    # If no logfile is specified, syslog is used
    # logfile: "/var/log/unbound/unbound.log"
    verbosity: 0

# Enable port if you're going to use DNSCrypt/ADGuardhome.
#    port: 5353

    do-ip4: yes
    do-udp: yes
    do-tcp: yes
    do-daemonize: no
    trust-anchor-file: /etc/unbound/trusted-key.key

    # May be set to yes if you have IPv6 connectivity
    do-ip6: no

    # Use this only when you downloaded the list of primary root servers!
    root-hints: "/etc/unbound/root.hints"

    # Trust glue only if it is within the servers authority
    harden-glue: yes

    # Require DNSSEC data for trust-anchored zones, if such data is absent, the zone becomes BOGUS
    harden-dnssec-stripped: yes

    # Don't use Capitalization randomization as it known to cause DNSSEC issues sometimes
    # see https://discourse.pi-hole.net/t/unbound-stubby-or-dnscrypt-proxy/9378 for further details
    use-caps-for-id: no

    # Reduce EDNS reassembly buffer size.
    # Suggested by the unbound man page to reduce fragmentation reassembly problems
    edns-buffer-size: 1472

    # TTL bounds for cache
    cache-min-ttl: 3600
    cache-max-ttl: 86400

    # Perform prefetching of close to expired message cache entries
    # This only applies to domains that have been frequently queried
    prefetch: yes

    # One thread should be sufficient, can be increased on beefy machines
    num-threads: 1

    # Ensure kernel buffer is large enough to not loose messages in traffic spikes
    so-rcvbuf: 1m

    hide-identity: yes
    hide-version: yes

Zur rekursiven Abfrage eines Hosts, der nicht als Adresse im Cache gespeichert ist, muss der Resolver an der Spitze des Serverbaums beginnen und die Root-Server abfragen, um zu erfahren, wo die Top-Level-Domain für die abgefragte Adresse zu finden ist. In Unbound sind standardmäßig Hinweise eingebaut. Wenn das Paket regelmäßig aktualisiert wird, ist daher kein manuelles Eingreifen erforderlich. Andernfalls ist es ratsam, eine Root-Hinweisdatei zu verwenden, da die eingebauten Hinweise veraltet sein können.

curl --output /etc/unbound/root.hints https://www.internic.net/domain/named.cache
sudo nano /etc/systemd/system/roothints.service
[Unit]
Description=Update root hints for unbound
After=network.target

[Service]
ExecStart=/usr/bin/curl -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache
sudo nano /etc/systemd/system/roothints.timer
[Unit]
Description=Run root.hints monthly

[Timer]
OnCalendar=monthly
Persistent=true
 
[Install]
WantedBy=timers.target
sudo systemctl enable --now unbound.service roothints.timer
sudo nano /etc/NetworkManager/conf.d/dns-servers.conf
[global-dns-domain-*]
servers=127.0.0.1
sudo systemctl restart NetworkManager.service

Wenn du unser DNSCrypt tutorial installieren willst, oder es bereits hast, musst Du noch den Port aktivieren

# Enable port if you're going to use DNSCrypt/ADGuardhome.
port: 5353

und füge unten den folgenden Eintrag hinzu:

# dnscrypt-proxy
  do-not-query-localhost: no
forward-zone:
  name: "."
  forward-addr: 127.0.0.1@5300
  • de/server/services/unbound.txt
  • Last modified: 2023/01/23 21:35
  • by dan