I just installed Ubuntu 18.04, and after i configured my web server i wanted to also replace the base dnsmasq since i needed support for wildcards. After I installed dnsmasq using this quide, the dnsmasq couldn't start because the port 53 was already used, so i tried to disable the base dnsmasq by commenting out dns=dnsmasq from the etc/NetworkManager/NetworkManager.conf but there was no such line ... so now i am asking you for help on how to disable the base dnsmasq.

3 Answers 3


You have systemd-resolved enabled as the local DNS server. You can disable it by setting DNSStubListener=no in /etc/systemd/resolved.conf and then restart the systemd-resolved service. It will then start without binding to port 53, allowing dnsmasq to bind instead.

  • Thank you mate. But i had no i solution so i just returned to ubuntu 16.05 in the meantime :D Apr 29, 2018 at 21:20
  • Didn't work for me, I ended up using /etc/hosts to set up my dev rules, instead of good old dnsmasq... And I have something like 15 rules to add. Not a PITA in the end (I only have to do it "once") but quite sad anyway :(
    – Alex Rock
    Jun 8, 2018 at 19:57
  • 1
    When I do this, I cannot connect to any websites: DNS does not work at all. do you know how I can fix this? I would really appreciate your help.
    – eeze
    Jul 3, 2018 at 20:27
  • 3
    @yosi1984 Does not work in Ubuntu 18.04 with July 2018 updates. This disables internet.
    – Redsandro
    Jul 25, 2018 at 14:24
  • Thanks man worked great on ubuntu 18.04 Jan 31, 2019 at 0:59

As yosi1984 surmised, port 53 was being used by systemd-resolved. His solution didn't work, but it led me to the correct question and answer: https://askubuntu.com/a/907249/25918


Ran across the same situation recently. For those of you who have disabled internet, it means you need to either setup the full implementation of dnsmasq to resolve internal (e.g., wildcard locals) and external domains.

Alternative approach for Ubuntu 18.04 is to ditch the full dnsmasq package in favor of the default dnsmasq-base, and strictly modify the DNS resolution via dnsmasq (base) in NetworkManager.

See https://askubuntu.com/questions/1029882/how-can-i-set-up-local-wildcard-127-0-0-1-domain-resolution-on-18-04?rq=1

If you have installed the dnsmasq package via apt-get, make sure you uninstall first. Don't forget to reload the NetworkManager at the end of setting the new configuration files.

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.