Sunday, December 28, 2025

How to Disable systemd-resolved in Ubuntu and Use a Custom DNS Server

 If you want to stop Ubuntu’s DNS resolver service and point your system to a different name server, you can disable systemd-resolved and configure DNS manually. On many Ubuntu systems /etc/resolv.conf is managed automatically, so changes may not persist unless you update the DNS setup correctly.

Stop the resolver service

Run the following command to stop the service immediately:

# sudo systemctl stop systemd-resolved.service

To prevent it from starting again after reboot, disable it with:

# sudo systemctl disable systemd-resolved.service

Set your DNS server

After disabling the service edit /etc/resolv.conf and replace the current DNS entry with your preferred name server:

# sudo vi /etc/resolv.conf

Then update the file with your DNS server, for example:

nameserver x.x.x.x

Replace x.x.x.x with the IP address of the DNS server you want to use. If /etc/resolv.conf is still a symlink, you may need to remove that link and replace it with a static file or manage DNS through systemd-resolved instead.


***

No comments:

Post a Comment