29

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

jrg
  • 60,611

3 Answers3

42

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!

jrg
  • 60,611
  • 3
    Our entire office is cloud hosted. Some stuff is on a private cloud in AWS with a VPN. dnsmasq was getting in the way of correct DNS resolution when on the VPN. I am the only linux user in the office and everyone else was mac. When I looked at a friends settings on his mac that's when it occurred to me what must be happing. I shut this off and life is good. – Christian Bongiorno May 12 '16 at 22:56
  • On Debian Bullseye my configuration required that I restart NetworkManager this way; systemctl restart NetworkManager YMMV – jeremiah Oct 03 '22 at 14:08
2

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.

2

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
Zanna
  • 70,465