Score:0

Ubuntu 20.04 LTS /etc/resolv.conf is getting overwritten after either netplan apply or server reboot and not able access DNS

ph flag
S M

Ubuntu 20.04 LTS /etc/resolv.conf is getting overwritten after either netplan apply or server reboot. We are not using networkmanager.

We did the following changes not sure if this will help:

sudo unlink /etc/resolv.conf
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved
sudo systemctl enable systemd-resolved

Add DNS in netplan and do sudo netplan apply.

Score:0
cr flag

As the /etc/resolv.conf said, you shouldn't edit that file as is managed by Systemd. Add your DNS configuration on /etc/systemd/resolved.conf. A better practice would not be editing the original configuration file but create another one, like /etc/systemd/resolved.conf.d/dns_servers.conf

[Resolve]
DNS=8.8.8.8

Remember to restart the service with sudo systemctl restart systemd-resolved

S M avatar
ph flag
S M
thanksAs the /etc/resolv.conf said, you shouldn't edit that file as is managed by Systemd. Add your DNS configuration on /etc/systemd/resolved.conf. A better practice would not be editing the original configuration file but create another one, like /etc/systemd/resolved.conf.d/dns_servers.conf [Resolve] DNS=8.8.8.8 ---> can i add my namesserver Remember to restart the service with sudo systemctl restart systemd-resolved
Ockham avatar
cr flag
Yes, you can add whatever DNS you want.
S M avatar
ph flag
S M
thanks we dont have network manager, i hope this will work
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.