Disable systemd-resolved on Centos 7

In this guide, you will learn to Disable systemd-resolved on Centos 7. In the Linux operation system, the systemd-resolved service brings a DNS resolver facility.

If you are using your own DNS server, so you need to disable your systemd-resolved service which is listening on port 53. If you don’t disable this service, you aren’t able to use your DNS server.

To disable your systemd-resolved service on Centos, you can follow the steps below.

How To Disable systemd-resolved on Centos 7?

To disable this service on your server, you can download the disable-systemd-resolved.sh package by using the following wget command:

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

Then, run the script to disable your systemd-resolved service:

bash disable-systemd-resolved.sh

Or, you can use the following commands instead:

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

Create a /etc/resolv.conf file on Centos 7

At this point, you need to remove the default /etc/resolv.conf file with the following command:

rm -f /etc/resolv.conf

Then, create a new file on your server. For example:

tee /etc/resolv.conf << END

That’s it, you are done.


At this point, you have learned to disable your systemd-resolved service which is listening on port 53, and create your own DNS server on Centos 7. With this option, you can use your DNS server.

Hope you enjoy it. You may be interested in these articles:

How To Clear Yum Cache on Centos 7

How To Enable IP Forwarding in Linux

Upgrade Linux Kernel on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!