I use unbound and usually use openDNS as my DNS server.

When I run dig google.com say I get SERVER: What exactly is this thing listening on port #53? is this unbound or is it something to do with dnsmasq (do I even have dnsmasq installed as dnsmasq.conf doesn't seem to be in /etc?)

In resolv.conf there is nameserver but then in network manager I have the DNS servers pointed to the two openDNS addresses. So what is going on here? does the local nameserver point to dnsmasq which then uses the values from network manager? or is it unbound that is in fact listening?

  • what are you trying to accomplish ? Dec 25 '12 at 20:29
  • 4
    just understanding really
    – fpghost
    Dec 25 '12 at 20:48
  • is this ubuntu server edition or what ? Dec 25 '12 at 20:49
  • no just desktop
    – fpghost
    Dec 25 '12 at 22:23

By default, NetworkManager uses Dnsmasq as a DNS resolver, if it's installed. Which is the default on Debian based systems, so Dnsmasq runs in a default configuration where it only resolves names based on the upstream servers specified by command line options (plus the contents of /etc/hosts). You have no /etc/dnsmasq.conf because that file is only present in the optional package dnsmasq.

To see whether your system is currently using Dnsmasq or Unbound for DNS queries, run netstat -ulnp | grep ":53 ".

In Ubuntu 12.04, NetworkManager doesn't play well with other DNS resolvers (see bug 959037Thomas Hood's summary pretty much covers it all). To keep running Unbound together with NetworkManager, your best bet is to tell NetworkManager not to run Dnsmasq (you don't need it in addition to Unbound, not unless you're using features of Dnsmasq that NetworkManager doesn't use). To do that:

  1. Edit /etc/NetworkManager/NetworkManager.conf to comment out the line containing dns=dnsmasq (add a # at the beginning of that line).
  2. Restart NetworkManager with service network-manager restart.
  • how does Ubuntu currently know to use Unbound?(it does indeed seem to be using it); what I'm getting at is why I don't need something like dns=unbound in /etc/NetworkManager/NetworkManager.conf ? and given that I currently have dns=dnsmasq in that file, why is Ubuntu actually using unbound?
    – fpghost
    Dec 25 '12 at 23:44
  • @fpghost Which one you get depends on which one started first. If you boot with no network, you'll get Unbound because it will start first. If you boot with a network connection, I think it's a toss-up. Dec 26 '12 at 0:00
  • OK, but what I was really wondering is rather than completely comment out the dns=... line to stop dnsmasq being used, what if I replace the line with dns=unbound? Otherwise how does NetworkManager know that unbound will be the local resolver?
    – fpghost
    Dec 26 '12 at 11:03

In ubuntu 12.04 dnsmasq is now running by default due to being hard coded into network-manager. Using dnsmasq as local resolver by default on desktop installations That’s the second big change of this release. On a desktop install, your DNS server is going to be "" which points to a NetworkManager-managed dnsmasq server.


this means you are getting ans of your query from local dns i.e DNSMASQ.

If you don’t want a local resolver you can turn it off DNSMASQ using the following procedure.

You need to edit /etc/NetworkManager/NetworkManager.conf file

gksudo gedit /etc/NetworkManager/NetworkManager.conf

and comment out the following line from




Save the file and exit.

Now you need to restart network-manager using the following command

sudo systemctl restart network-manager

Reference link

  • 1
    OK, but what if I also have Unbound installed does this take precedence over dnsmasq as the local resolver? are both listening on #53? how do they get on together?
    – fpghost
    Dec 25 '12 at 22:26
  • also why is /etc/dnsmasq.conf absent?
    – fpghost
    Dec 25 '12 at 22:33
  • @fpghost dnsmasq listens on whereas unbound listens on, both on port 53. You can set dns=unbound in the network manager config to use unbound.
    – talonx
    Dec 13 '16 at 10:15

To see what actual DNS server was used to resolve your address, when using DNSMasq, cannot use DIG because it only reports, instead:

Enable Logging in DNSMasq:

sed -i 's/\#log-queries/log-queries/' /etc/dnsmasq.conf
systemctl restart dnsmasq

Log DNSMasq and monitor the output:

journalctl --unit dnsmasq.service -f

Ping a host:

ping google.ca

You can then see, my upstream DNS server ( resolves it:

: query[A] google.ca from
: forwarded google.ca to
: query[AAAA] google.ca from
: forwarded google.ca to
: reply google.ca is
: reply google.ca is 2607:f8b0:400b:80f::2003
: query[PTR] from
: forwarded to
: reply is iad23s25-in-f3.1e100.net
: reply is yyz10s14-in-f3.1e100.net

Ping a host behind company VPN (during split-tunnel) for *.company.com

ping box.company.com


: query[A] box.company.com from
: forwarded box.company.com to vpn.ser.ver.ip
: query[AAAA] box.company.com from

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.