Ubuntu 18.04: Disable dnsmasq-base and enable full dnsmasq

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.


Solution 1:

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.

Solution 2:

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

Solution 3:

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.