7

while I'm learning the DNS, I have installed too many apps such as BIND and DNSmasq and made some changes to /etc/resolve.conf

and now I would like to reset the DNS settings to defaults? I have removed DNSmasq and the things I remember but is there's someway to reset the DNS settings to defaults rather than reinstall the system?

2
  • What *buntu version are you using? Are you using systemd-resolved or not?
    – Gannet
    Jan 3, 2019 at 23:40
  • In tags you see ubuntu 18.04 is tagged, yes I have systemd-resolved enabled and running
    – Adam
    Jan 4, 2019 at 0:22

1 Answer 1

10

First, your /etc/systemd/resolved.conf should look like:

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes

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

And check your systemd-resolved is enabled with: systemctl status systemd-resolved.service and if not then enable it: systemctl enable systemd-resolved.service and start: systemctl start systemd-resolved.service

Seems, that's all.

2
  • Thank you, I recently removed Pihole from a server and was running into DNS issues. With all the changes made to Ubuntu networking, I had a hard time figuring out which method worked. This set things back to normal. Sep 16, 2019 at 21:09
  • 1
    Didn't work for me. Chrome still gives DNS_PROBE_FINISHED_BAD_CONFIG. status systemd-resolved.service gives another process is listening on tcp socker 127.0.0.53:53 turning off local DNS stub support May 12, 2020 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.