resolv.conf questions

Tom H tomh0665 at gmail.com
Thu Aug 8 08:07:51 UTC 2019


On Wed, Aug 7, 2019 at 8:30 PM Robert Heller <heller at deepsoft.com> wrote:
> At Wed, 7 Aug 2019 19:54:59 +0800 <ubuntu-users at lists.ubuntu.com> wrote:
>>
>> Sorry I was still confused.
>>
>> When I put the line into /etc/resolv.conf:
>>
>> nameserver 8.8.8.8
>>
>> after a while it was replaced by the default one:
>>
>> nameserver 127.0.0.53
>>
>> How can I enforce to use 8.8.8.8 as nameserver?
>
> Either you need to read the man pages for systemd-resolved and
> update its configuration (possibly non-trivial) OR do this:
>
> sudo systemctl stop systemd-resolved
> sudo systemctl disable systemd-resolved
>
> *Then* edit /etc/resolv.conf
>
> (I know some people will tell you not to do that.)

Terrible idea!

1) If you edit "/etc/resolv.conf" while it's a symlink to a file under
"/run", you're editing the latter file and, after a reboot with
systemd-resolved disabled, you'll have an empty "/etc/resolv.conf".

2) If you delete the "/etc/resolv.conf" symlink, edit it as a regular
file, and are using NM with its default settings and the dhcp-default
dhclient or are using ifupdown with its default settings and the
dhcp-default dhclient, after a reboot, "/etc/resolv.conf" will contain
the dhcp-provided nameserver(s). (systemd-networkd manipulates
"/etc/resolv.conf" via systemd-resolved.)




More information about the ubuntu-users mailing list