How to enable and disable systemd-resolved in Ubuntu

Photo by Pixabay on Pexels
Published 16 October 2021 Last updated 21 June 2022 An older guide that hasn't been re-checked yet, so commands or versions may have moved on. How guides are made and checked

This guide will show you how to enable and disable the systemd-resolved service in Ubuntu.

What is systemd-resolved?

systemd-resolved is a systemd service that provides network name resolution to local applications. Additionally, systemd-resolved is installed by default as part of the systemd package.

systemd-resolved provides the following resolver services:

  • Domain Name System (DNS, DNSSEC and DNS over TLS)
  • Multicast DNS
  • Link-Local Multicast Name Resolution
Watch the video on YouTube

Why would you disable it?

You may want to disable systemd-resolved so that you can use another resolver on the same host. For example, you must do this before installing PiHole as the alternative DNS server.

psst
Pi-hole is an advertisement blocking application that acts as a DNS. It also blocks Internet trackers. Click here to learn more.

You need to disable one DNS service since you cannot have two services listening on the same port.

Changes as of Ubuntu 18.04

Netplan is now the default network management tool as of Ubuntu 18.04. Netplan replaces the /etc/resolv.conf and /etc/network/interfaces configuration files used to configure the network.

How to disable systemd-resolved in Ubuntu

Run the following commands to disable and stop the systemd-resolved service:

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved.service

How to enable systemd-resolved in Ubuntu

Run the following commands to enable and start the systemd-resolved service:

sudo systemctl enable systemd-resolved.service
sudo systemctl start systemd-resolved.service

You may also be interested in