Maintenant que la configuration du réseau est faite, il faut s'occuper de la résolution DNS.
Rien de plus simple, il suffit d'activer le service :
systemctl enable systemd-resolved.service
effacer l'ancien fichier resolv.conf :
rm /etc/resolv.conf
le remplacer par un lien symbolique :
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
et lancer le service :
systemctl start systemd-resolved.service
Deux possibilités pour configurer les DNS
Si l'on veut obtenir les DNS via le client DHCP de systemd-networkd on tape :
nano /etc/systemd/network/eth0.network
Et on rédige par exemple :
[Match] Name=eth0 [Network] DNS=192.168.1.1 Address=192.168.1.40/24 Gateway=192.168.1.1
nano /etc/systemd/resolved.conf
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # See resolved.conf(5) for details [Resolve] DNS=4.2.2.4 4.2.2.2 209.244.0.4 209.244.0.3
et de redémarrer le service :
systemctl restart systemd-resolved.service
systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
systemctl status systemd-resolved.service
systemctl stop systemd-resolved.service