Changer les nameserver des DNS résolveurs sur Debian 11
Il suffit d'installer le package resolvconf
$ sudo apt install resolvconf
et puis de renseigner les nameserver dans le bon fichier...
$ cat /etc/resolvconf/resolv.conf.d/head
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.
nameserver 208.67.222.222
nameserver 2620:119:35::35
nameserver 1.1.1.1
nameserver 22606:4700:4700::1111
$ sudo vim /etc/resolvconf/resolv.conf.d/head
#nameserver 208.67.222.222
#nameserver 2620:119:35::35
#nameserver 1.1.1.1
#nameserver 22606:4700:4700::1111
nameserver 8.8.8.8
nameserver 8.8.4.4
$ sudo systemctl restart resolvconf.service
$ sudo systemctl restart systemd-resolved.service
$ sudo systemctl status resolvconf.service
● resolvconf.service - Nameserver information manager
Loaded: loaded (/lib/systemd/system/resolvconf.service; enabled; vendor preset: enabled)
Active: active (exited) since Tue 2022-05-31 16:45:49 CEST; 13s ago
Docs: man:resolvconf(8)
Process: 26310 ExecStart=/sbin/resolvconf --enable-updates (code=exited, status=0/SUCCESS)
Main PID: 26310 (code=exited, status=0/SUCCESS)
CPU: 1ms
mai 31 16:45:49 n151cu-d2 systemd[1]: Started Nameserver information manager.
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.
#nameserver 208.67.222.222
#nameserver 2620:119:35::35
#nameserver 1.1.1.1
#nameserver 22606:4700:4700::1111
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 192.168.1.254
nameserver 127.0.0.53
search lan
Et ça marche
Source : https://www.tecmint.com/set-permanent-dns-nameservers-in-ubuntu-debian/