I have a two local DNS configured which sometimes works and sometimes it does not, using Ubuntu 20.04
I defined my local DNS with the GUI:
Why it works sometimes and sometime not is very well explained in Local DNS dissapears from resolver after a while . The internet is slow, there is a timeout and access to the public DNS fails. So then next DNSnames server appears, which is my local DNS. And than I can access my local URL.
When executing systemd-resolve --status | sed -n '/DNS Servers/,/^$/p'
I get:
DNS Servers: 10.0.2.3
192.168.1.70
192.168.1.1
DNS Domain: ~.
But DNS server 10.0.2.3 I never defined, as far as I can recall.
When, again sometimes, my local DNS is used, everything works as desired. I can check this with:
resolvectl status
if it returns (I stripped the content a bit):
Link 2 (enp0s3)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 192.168.1.70
DNS Servers: 10.0.2.3
192.168.1.70
192.168.1.1
DNS Domain: ~.
So the current DNS Server: 192.168.1.70 as wanted. But this is not always the case. I want to make my system more stable it will always use 192.168.1.70
When cat /run/systemd/resolve/resolv.conf
I can see 10.0.2.3 is really defined. I can not (and should not) edit this file but edit /etc/resolv.conf instead.
Viewing cat /etc/resolv.conf
does not show DNS server 10.0.2.3 but is does show nameserver 127.0.0.53
And, it again I should not edit this file.
This is weird. First, from a generated file, I get pointed to a file which is used to generated that file and which I should edit instead. And second in that file is a different DNS nameserver mentioned so it seems run/systemd/resolve/resolv.conf
is generated from somewhere else.
According to https://askubuntu.com/tags/resolvconf/info is the program to edit resolv.conf. So I tried to use that.
bernard@VBoxMain20:/etc$ resolvconf
Command 'resolvconf' not found, but can be installed with:
sudo apt install openresolv # version 3.10.0-1, or
sudo apt install resolvconf # version 1.82
bernard@VBoxMain20:/etc$ sudo apt install openresolv
So I executed resolvconf
but found no way to edit resolv.conf
I also tried to use netplan available from Ubuntu 18.04+ but without success.
I simply want to use the DNS nameservers I defined myself in the GUI and nothing else. How can I do that?
sudo systemd-resolve --set-dns=10.88.17.67 -i enp0s31f6