Disable systemd-resolved and configure Network-Manager to get DNS from DHCP in Lubuntu 20.04

Lubuntu 20.04 come with systemd-resolved for DNS resolve and it have some issue in handling DNS priority between multiple DNS server (https://github.com/systemd/systemd/issues/5755).

To over come this issue, disable systemd-resolved and configure Network-Manager to use the DNS nameservers provided by your DHCP settings.

Reminder: Disable systemd-resolved will disable local dns query caching.

1. Disable systemd-resolved service.

sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved

2. Remove /etc/resolv.conf.

sudo rm /etc/resolv.conf

3. Add below dns entry to /etc/NetworkManager/NetworkManager.conf. NetworkManager will auto generate /etc/resolv.conf with below settings.

[main]
dns=default

4. Remember to restart your Network-Manager service or just reboot your system.

sudo systemctl restart NetworkManager

5. To revert back the changes, just undo the previous setting and create the resolv.conf symlink from systemd-resolved.

sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Comments