Résolveur DNS avec Unbound

Mise en place de Unbound

Installation du paquet :

# apt install unbound

Configuration de l’écoute sur l’interface interne :

/etc/unbound/unbound.conf.d/home-resolver.conf
server:
    # the interface that is used to connect to the network (this will listen to all interfaces)
    interface: ens19
    # addresses from the IP range that are allowed to connect to the resolver
    access-control: 10.0.X.0/24 allow

Redémarrage de Unbound pour prendre en compte la nouvelle configuration :

# systemctl restart unbound

Test depuis un des clients :

$ dig A triscl.bzh @10.0.X.1

; <<>> DiG 9.20.15-1~deb13u1-Debian <<>> A triscl.bzh @10.0.X.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25202
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;triscl.bzh.                    IN      A

;; ANSWER SECTION:
triscl.bzh.             86400   IN      A       78.114.13.63

;; Query time: 248 msec
;; SERVER: 10.0.X.1#53(10.0.X.1) (UDP)
;; WHEN: Tue Dec 16 15:44:38 UTC 2025
;; MSG SIZE  rcvd: 55

Ajout de Unbound dans le DHCP

Il faut modifier le fichier du chapitre précédent, et ajouter un attribut dans les options, à côté de la passerelle par défaut :

/etc/kea/kea-dhcp4.conf
{
  ...
  "option-data": [
    {
      "name": "routers",
      "data": "10.0.X.1"
    },
    {
      "name": "domain-name-servers",
      "data": "10.0.X.1"
    }
  ],
  ...
}

Ne pas oublier de redémarrer le serveur DHCP avec :

# systemctl restart kea-dhcp4-server.service

Si tout va bien, côté client, on devrait voir apparaître dans /etc/resolv.conf la ligne :

nameserver 10.0.X.1