Disable systemd-resolved on Ubuntu/Deb/CentOS

systemd-resolved provide DNS resolver facility in newer version of Linux servers running systemd.

I prefer manually editing /etc/resolv.conf and add resolvers. If you are running your own DNS server, then you need to disable systemd-resolved as it listen on port 53, with out disabling the service, you can’t start your DNS server.

To disable systemd-resolved, run

wget https://raw.githubusercontent.com/serverok/server-setup/master/tools/disable-systemd-resolved.sh
bash disable-systemd-resolved.sh

Or do the following.

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

Now create /etc/resolv.conf file

rm -f /etc/resolv.conf
tee /etc/resolv.conf << END
nameserver 8.8.8.8
nameserver 1.1.1.1
END

See resolv.conf, dns

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *