Monday, June 06, 2022

changing DNS server for lookups on a systemd Linux machine using the terminal

GUI-based DNS changes are fine, but there seems to be a lot of conflicting info on changing the DNS server using the command line on Linux. For example, 

For Ubuntu 20.04, https://phoenixnap.com/kb/ubuntu-dns-nameservers needs the yaml file in /etc/netplan to be edited, but on Linux Mint 20.3, that yaml file does not contain anything except 

  # Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

This post https://forums.linuxmint.com/viewtopic.php?t=321682 talks about installing resolvconf and creating / editing a file  /etc/resolvconf/resolv.conf.d/head which does not exist on Linux Mint 20.3

What does exist is 

/etc/systemd/resolved.conf

(but it has no entries) and also

/etc/resolv.conf

(but it says # This file is managed by man:systemd-resolved(8). Do not edit.
And it does not have the custom name server 8.8.8.8 I have configured via the GUI. )

From https://wiki.archlinux.org/title/Systemd-resolved#Manually I find that the file
/etc/systemd/resolved.conf.d/dns_servers.conf
does not exist - there is no directory called /etc/systemd/resolved.conf.d/

This thread
https://www.digitalocean.com/community/questions/fedora-33-how-to-persist-dns-settings-via-etc-resolv-conf
has some clues about why some methods work, and why some don't - various distros are changing the way in which DNS resolution works, so we would need to look at our specific distribution's docs for correct info.  

Edit: And this thread gives some details about Linux Mint 20.3 - basically saying that we have to use the GUI - https://forums.linuxmint.com/viewtopic.php?t=371120



No comments:

Post a Comment