how to reset DNS settings to the defaults?

13,316

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.

Share:
13,316

Related videos on Youtube

Adam
Author by

Adam

Updated on September 18, 2022

Comments

  • Adam
    Adam over 1 year

    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?

    • Gannet
      Gannet over 5 years
      What *buntu version are you using? Are you using systemd-resolved or not?
    • Adam
      Adam over 5 years
      In tags you see ubuntu 18.04 is tagged, yes I have systemd-resolved enabled and running
  • Cameron Wilby
    Cameron Wilby over 4 years
    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.
  • Philip Rego
    Philip Rego almost 4 years
    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