How can I disable the DNS that Network Manager uses?

Ubuntu uses a DNSMasq instance for Network Manager starting in 12.04 - how can I disable it?


Edit /etc/NetworkManager/NetworkManager.conf with the following command:

gksu gedit /etc/NetworkManager/NetworkManager.conf

Enter in your password when prompted.

Comment out the line dns=dnsmasq, so it looks like this:

#dns=dnsmasq

and then restart Network Manager with

sudo restart network-manager
# if you get /com/ubuntu/upstart: Connection refused, try:
sudo service network-manager restart

Ta-da! You're all set!


If this still does not work for you, like was my case with Ubuntu 16.10. Then check who is using this port with:

lsof -i :53

And if you for example have "systemd-r", then you have to stop the service with:

sudo service systemd-resolved stop

I also had this problem, but I'm on Ubuntu 16.04, so the original solution did not work. However, this page had the solution.

Add DNSStubListener=no in /etc/systemd/resolved.conf and then restart the systemd-resolved service. Now, the built-in dnsmasq should not start automatically.

You will also need to make sure that dns=dnsmasq is commented out in /etc/NetworkManager/NetworkManager.conf, like the previous answer specifies.