In the latest distributions of ubuntu 18.04 and 20.04 that I used have activated the sysemd-resolved that I do not like at all, especially for not allowing me a more particular management to my needs in resolv.conf. And always the inactive. I detail how to do it.

The first thing is to stop the systemd-resolved service that provides it, with a user who has adequate privileges or using sudo:

systemctl stop systemd-resolved

As the service will be configured to start with the startup of the system we must disable it with:

systemctl disable systemd-resolved

Then we delete the resolv.conf file located in /etc:

rm /etc/resolv.conf

At this point we must configure network-manager to specify if we want a resolv.conf file to be generated automatically according to the network connection that we acquire using the DNS that it informs or if we want to write a specific resolv.conf file that is not rewritten in each restart of the system or the network-manager.

If we want the resolv.conf file to be generated with the DNS of the network connection we must change the file /etc/NetworkManager/NetworkManager.conf specifying within '[main]' the property 'dns=default':

[main]
plugins=ifupdown,keyfile
dns=default

[ifupdown]
...

With this configuration we can modify the file /etc/resolv.conf to add the nameserver that we consider but in the next restart of the system or the network-manager that file will be updated losing our changes.

If what we want is to have a resolv.conf file with our configuration, we create it and fill it; and in the file /etc/NetworkManager/NetworkManager.conf we specify within the tag '[main]' the property 'dns=none':

[main]
plugins=ifupdown,keyfile
dns=none

[ifupdown]
...

Once configured network-manager we restart it and it would be:

service network-manager restart

And perform a test by restarting the computer.

I have not done it in other distributions with which I work like CentOS or RedHat, but I understand that it is done in a homologous way.