Just learning about networking.

I'm on Mint-18. Use network-manager. dnsmasq is enabled.

I would like addresses that end with a particular domain-name to get resolved through a private-nameserver.

When I add a private-nameserver using the server option to the dnsmasq configuration file, everything fails. I can't even resolve google.com:

> nslookup google.com
;; connection timed out; no servers could be reache

If I remove the server option and add the same private-nameserver to the top of \etc\resolve.conf, restart network-manager things work again and I can resolve private-hosts names.

> nslookup abcprivate.net
Server:     nn.nn.nn.nn
Address:    nn.nn.nn.nn#53

Non-authoritative answer:
Name:   abcprivate.net
Address: mm.mm.mm.mm

So I know that the private-nameserver is correct. So it must be the way I'm configuring dnsmasq.

Here is my config file

>cat /etc/NetworkManager/dnsmasq.d/dnsmasq.conf

where abcprivate.net is the domain of the private network, and nn are digits.

2 Answers 2


It turned out that my settings were correct but they weren't being used.

>ps ax | grep dnsmasq
 1273 ?        S      0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address= --cache-size=0 --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d

As can be seen it wasn't using the conf file...I did a few other tests to make sure that was the case.

I did end up solving the problem, but I did it by:

  • Disabling Network-manager dnsmasq plugin: comment out dns line in /etc/NetworkManager/NetworkManager.conf
  • Moving the /etc/NetworkManager/dnsmasq.d/dnsmasq.conf to /etc/dnsmasq.conf
  • Adding a catch all name server to the /etc/dnsmasq.conf (see bellow for file listing)
  • Adding the dnsmasq address to the top of the /etc/resolve.conf (by changing /etc/resolvconf/resolv.conf.d/head file...see bellow for file listing)
  • Starting dnsmasq such that it won't read the resolve.conf: dnsmasq -d -R -q (I wanted to log the queries on the screen so that I could see what was going on).
  • One I had everything working I encapsulated the dnsmasq in a systemD unit-file

$ cat /etc/dnsmasq.conf

$ cat /etc/resolvconf/resolv.conf.d/head    

$ cat /etc/systemd/system/dnsmasq.service
Description=SystemD - Dnsmasq is a Domain Name System (DNS) forwarder

ExecStart=/usr/sbin/dnsmasq -d -q -R
  • I followed you solution and I was trying to add dnsmasq to systemD like you have in /etc/systemd/system/dnsmasq.service but it doesn't start on reboot > sudo systemctl status dnsmasq.service ● dnsmasq.service - SystemD - Dnsmasq is a Domain Name System (DNS) forwarder Loaded: loaded (/etc/systemd/system/dnsmasq.service; static; vendor preset: enabled) Drop-In: /run/systemd/generator/dnsmasq.service.d └─50-dnsmasq-$n Any advice ... ? Commented Jun 27, 2017 at 16:52
  • @RaduGabriel Sorry I don't know...it may not start automatically but you can always start it manually. The important thing for me was to dnsmasq to work.
    – hba
    Commented Jun 29, 2017 at 18:48
  • The /etc/NetworkManager/dnsmasq.c/dnsmasq.conf is ignored for many if not all parameters because some of them are hardcoded in NetworkManager source code. See this post: shiliangya.blogspot.com/2016/02/… and also because one of the hardcoded settings is conf-file=/dev/null which prevents a conf-file from being read, even if the parameter for the conf-file-dir is also set.
    – gstanden
    Commented Oct 31, 2017 at 20:04

I believe dnsmasq can do what you want, but it also sounds like you've got some problems with dnsmasq.conf

You probably need this line uncommented in dnsmasq.conf:


Then you need a file /etc/dnsmasq.resolv with some other nameserver in it. I've got this:


Further, I think you need lines somewhat like these in /etc/dnsmasq.conf:


The first one sets the IP address server for the ".intranet" domain. My original DSL modem used addresses inside, so that's what I've got today. The 2nd line lets you look up hostnames from IP addresses. The third line tells dnsmasq to look up fully qualified names in ".intranet" domain in /etc/hosts, or from what clients register in dnsmasq DHCP. is the IP address of the machine running dnsmasq.

To summarize: dnsmasq.resolv sets the IP address that dnsmasq will forward other names to. The server and local settings determine the IP address of a DNS server for a particular domain, and where to get addresses for names in that domain.

  • Thank you. But i wasn't able to use your answer. I could not configure dnsmasq as a plugin to network manager.
    – hba
    Commented Nov 16, 2016 at 4:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .